diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..5601d3bbb232b817dddb815531d4697e507721ab
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/target/
+.project
+.classpath
+/.settings
diff --git a/Dockerfile.osom b/Dockerfile.osom
new file mode 100644
index 0000000000000000000000000000000000000000..f58352e6448da0c482f6b2a48134103141e7c09c
--- /dev/null
+++ b/Dockerfile.osom
@@ -0,0 +1,8 @@
+FROM ibm-semeru-runtimes:open-17.0.7_7-jdk
+MAINTAINER openslice.io
+RUN mkdir /opt/shareclasses
+RUN mkdir -p /opt/openslice/lib/
+COPY target/org.etsi.osl.osom-1.2.0-SNAPSHOT.jar /opt/openslice/lib/
+COPY target/org.etsi.osl.osom-1.2.0-SNAPSHOT-exec.jar /opt/openslice/lib/
+COPY . /opt/openslice/lib/
+CMD ["java", "-Xshareclasses:cacheDir=/opt/shareclasses","-jar", "/opt/openslice/lib/org.etsi.osl.osom-1.2.0-SNAPSHOT-exec.jar"]
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64
--- /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 c0356539a926a19a88a70255c9c4eeb2dd1c27ac..056bf5872c1b192954812e3a825562b81640eb2c 100644
--- a/README.md
+++ b/README.md
@@ -1,92 +1,3 @@
# org.etsi.osl.osom
-
-
-
-## 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.osom.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.osom/-/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 Service Orchestration and Order Management.
+It is based on open source Flowable (https://www.flowable.org) Business process engine
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..343c6c1d2fae7e80dd74c2f464ed18c730cf2a16
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,319 @@
+
+ 4.0.0
+
+ org.etsi.osl
+ org.etsi.osl.main
+ 1.2.0-SNAPSHOT
+ ../org.etsi.osl.main
+
+
+ org.etsi.osl.osom
+
+ org.etsi.osl.osom
+ http://maven.apache.org
+
+
+
+
+ UTF-8
+ UTF-8
+ ${spring-boot-version}
+ ${flowable-version}
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring.boot-version}
+ pom
+ import
+
+
+
+ org.apache.camel.springboot
+ camel-spring-boot-dependencies
+ ${camel.version}
+ pom
+ import
+
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.flowable
+ flowable-spring-boot-starter
+ ${flowable.version}
+
+
+
+ com.h2database
+ h2
+
+
+ org.etsi.osl
+ org.etsi.osl.tmf.api
+ ${project.version}
+
+
+
+ org.etsi.osl
+ org.etsi.osl.model
+ ${project.version}
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-activemq
+
+
+ org.apache.activemq
+ activemq-amqp
+ test
+
+
+ org.apache.qpid
+ proton-j
+
+
+
+
+ org.messaginghub
+ pooled-jms
+
+
+
+
+ org.apache.camel.springboot
+ camel-spring-boot-starter
+
+
+ org.apache.activemq
+ activemq-pool
+
+
+ org.apache.camel
+ camel-activemq
+
+
+ org.apache.activemq
+ activemq-broker
+
+
+
+
+ org.apache.camel.springboot
+ camel-service-starter
+
+
+
+ org.apache.camel.springboot
+ camel-http-starter
+
+
+ org.apache.camel
+ camel-jackson
+
+
+ org.apache.camel
+ camel-stream
+
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ com.jayway.jsonpath
+ json-path
+ 2.6.0
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+ org.springframework.security
+ spring-security-oauth2-client
+
+
+ org.springframework.security
+ spring-security-core
+
+
+ org.springframework.security
+ spring-security-web
+
+
+ org.springframework.security
+ spring-security-config
+
+
+
+ org.projectlombok
+ lombok
+ provided
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+ org.junit.platform
+ junit-platform-commons
+ test
+
+
+ org.junit.platform
+ junit-platform-runner
+ test
+
+
+ org.apache.activemq
+ activemq-broker
+ test
+
+
+ javax.jms
+ javax.jms-api
+ 2.0.1
+ test
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ ${java.version}
+ ${java.version}
+
+
+
+
+
+
+ org.codehaus.mojo
+ license-maven-plugin
+ ${maven-license-plugin.version}
+
+ false
+ ========================LICENSE_START=================================
+ =========================LICENSE_END==================================
+ *.json
+
+
+
+ generate-license-headers
+
+ update-file-header
+
+ process-sources
+
+ ${license.licenseName}
+
+
+
+
+ download-licenses
+
+ download-licenses
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot-version}
+
+
+
+ repackage
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot-version}
+
+ exec
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/org/etsi/osl/osom/OsomSpringBoot.java b/src/main/java/org/etsi/osl/osom/OsomSpringBoot.java
new file mode 100644
index 0000000000000000000000000000000000000000..423aa634d55a3d286598beac3122df00ab11b054
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/OsomSpringBoot.java
@@ -0,0 +1,102 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import org.flowable.engine.RepositoryService;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.TaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.ExitCodeGenerator;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+//import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+//import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.FilterType;
+
+/**
+ * @author ctranoris
+ *
+ */
+
+//
+
+//@EnableDiscoveryClient
+//@RefreshScope
+//@EnableConfigurationProperties
+//@EnableAutoConfiguration
+@SpringBootApplication
+//@ComponentScan(basePackages = {
+// "org.etsi.osl.osom"
+//})
+
+public class OsomSpringBoot implements CommandLineRunner {
+
+ private static ApplicationContext applicationContext;
+
+ @Autowired
+ RepositoryService repositoryService;
+
+ @Autowired
+ RuntimeService runtimeService;
+
+ @Autowired
+ TaskService taskService;
+
+ @Override
+ public void run(String... arg0) throws Exception {
+ if (arg0.length > 0 && arg0[0].equals("exitcode")) {
+ throw new ExitException();
+ }
+
+ System.out
+ .println("Number of process definitions : " + repositoryService.createProcessDefinitionQuery().count());
+ System.out.println("Number of tasks : " + taskService.createTaskQuery().count());
+ System.out.println("Number of process instances : " + runtimeService.createProcessInstanceQuery().count() );
+ //runtimeService.startProcessInstanceByKey("oneTaskProcess");
+ //System.out.println("Number of tasks after process start: " + taskService.createTaskQuery().count());
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ applicationContext = new SpringApplication(OsomSpringBoot.class).run(args);
+
+// for (String beanName : applicationContext.getBeanDefinitionNames()) {
+// System.out.println(beanName);
+// }
+ }
+
+ class ExitException extends RuntimeException implements ExitCodeGenerator {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public int getExitCode() {
+ return 10;
+ }
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/configuration/ActiveMQComponentConfig.java b/src/main/java/org/etsi/osl/osom/configuration/ActiveMQComponentConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..a49908f2cc863701e0716cba86a3739a15795432
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/configuration/ActiveMQComponentConfig.java
@@ -0,0 +1,41 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.bugzilla
+ * %%
+ * 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.osom.configuration;
+
+import org.apache.camel.component.activemq.ActiveMQComponent;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import jakarta.jms.ConnectionFactory;
+
+/**
+ * @author ctranoris
+ *
+ */
+@Configuration
+public class ActiveMQComponentConfig {
+
+ @Bean(name = "activemq")
+ public ActiveMQComponent createComponent(ConnectionFactory factory) {
+ ActiveMQComponent activeMQComponent = new ActiveMQComponent();
+ activeMQComponent.setConnectionFactory(factory);
+ return activeMQComponent;
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/configuration/MvcConfig.java b/src/main/java/org/etsi/osl/osom/configuration/MvcConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..4d470eb531f740a3a99a16566a7f7c09ec0ba442
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/configuration/MvcConfig.java
@@ -0,0 +1,24 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.configuration;
+
+public class MvcConfig {
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/configuration/OSOMRouteBuilder.java b/src/main/java/org/etsi/osl/osom/configuration/OSOMRouteBuilder.java
new file mode 100644
index 0000000000000000000000000000000000000000..e4ac7e7470a3601bcd9a00546a16646d59464c1c
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/configuration/OSOMRouteBuilder.java
@@ -0,0 +1,169 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.configuration;
+
+import java.util.Date;
+import java.util.Map;
+import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.dataformat.JsonLibrary;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.etsi.osl.osom.serviceactions.ServiceActionCheck;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.model.ExperimentMetadata;
+import org.etsi.osl.model.Product;
+import org.etsi.osl.model.ValidationJob;
+import org.etsi.osl.model.ValidationStatus;
+import org.etsi.osl.model.VxFMetadata;
+import org.etsi.osl.tmf.am642.model.AlarmCreate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+
+@Configuration
+//@RefreshScope
+@Component
+public class OSOMRouteBuilder extends RouteBuilder {
+
+ private static final transient Log logger = LogFactory.getLog(OSOMRouteBuilder.class.getName());
+
+
+
+
+ @Value("${CRD_DEPLOY_CR_REQ}")
+ private String CRD_DEPLOY_CR_REQ = "";
+
+
+
+ public void configure() {
+
+
+
+
+
+ from("direct:retriesCRD_DEPLOY_CR_REQ")
+ .errorHandler(deadLetterChannel("direct:retriesDeadLetters")
+ .maximumRedeliveries( 10 ) //let's try 10 times to send it....
+ .redeliveryDelay( 30000 ).useOriginalMessage()
+ //.deadLetterHandleNewException( false )
+ //.logExhaustedMessageHistory(false)
+ .logExhausted(true)
+ .logHandled(true)
+ //.retriesExhaustedLogLevel(LoggingLevel.WARN)
+ .retryAttemptedLogLevel( LoggingLevel.WARN) )
+ .to(CRD_DEPLOY_CR_REQ);
+
+
+ /**
+ * dead Letter Queue Users if everything fails to connect
+ */
+ from("direct:retriesDeadLetters")
+ //.setBody()
+ //.body(String.class)
+ .process( ErroneousValidationProcessor )
+ .to("stream:out");
+
+// .errorHandler(deadLetterChannel("direct:dlq_bugzilla")
+// .maximumRedeliveries( 4 ) //let's try for the next 120 mins to send it....
+// .redeliveryDelay( 60000 ).useOriginalMessage()
+// .deadLetterHandleNewException( false )
+// //.logExhaustedMessageHistory(false)
+// .logExhausted(true)
+// .logHandled(true)
+// //.retriesExhaustedLogLevel(LoggingLevel.WARN)
+// .retryAttemptedLogLevel( LoggingLevel.WARN) )
+
+// from("jms:queue:OSOM.NEW_SERVICEORDER_PROCESS")
+// .log(LoggingLevel.INFO, log, "New OSOM.IN.SERVICEORDER message received!")
+// .to("log:DEBUG?showBody=true&showHeaders=true")
+// .unmarshal().json( JsonLibrary.Jackson, ServiceOrder.class, true)
+// .log(LoggingLevel.INFO, log, "Order id = ${body.id} ")
+// .bean( ServiceOrderManager.class, "processOrder")
+// ;
+//
+// from("jms:queue:OSOM.NEW_SERVICEORDER_PROCESS.LIST_PENDING")
+// .log(LoggingLevel.INFO, log, "New OSOM.NEW_SERVICEORDER_PROCESS.LIST_PENDING message received!")
+// .to("log:DEBUG?showBody=true&showHeaders=true")
+// .bean( ServiceOrderManager.class, "getTasks")
+// ;
+//
+//
+//
+//
+// from("jms:queue:OSOM.HUMAN_COMPLETE_ORDER_TASK")
+// .log(LoggingLevel.INFO, log, "New OSOM.HUMAN_COMPLETE_ORDER_TASK message received!")
+// .to("log:DEBUG?showBody=true&showHeaders=true")
+// //.unmarshal().json( JsonLibrary.Jackson, ServiceOrder.class, true)
+// //.log(LoggingLevel.INFO, log, "Order id = ${body.id}")
+// .bean( ServiceOrderManager.class, "humanComplete");
+
+
+
+ //create route here to get service spec by id from model via bus
+
+//
+// from("activemq:OSOMIN_TEXT")
+// .log(LoggingLevel.INFO, log, "New activemq:OSOMIN_TEXT message received")
+// .setBody(constant("46"))
+// .to("stream:out")
+// .end();
+//
+// from("seda:OSOMIN_SERVICEORDERTEXT").log(LoggingLevel.INFO, log, "New seda:OSOMIN_SERVICEORDERTEXT message received")
+// .to("stream:out");;
+//
+ }
+
+ Processor ErroneousValidationProcessor = new Processor() {
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+
+ Map headers = exchange.getIn().getHeaders();
+ Product aProd = exchange.getIn().getBody( Product.class );
+
+
+ if (aProd instanceof VxFMetadata) {
+ ((VxFMetadata) aProd).setValidationStatus( ValidationStatus.COMPLETED );
+ } else if (aProd instanceof ExperimentMetadata) {
+ ((ExperimentMetadata) aProd).setValidationStatus( ValidationStatus.COMPLETED );
+ }
+
+
+ if ( aProd.getValidationJobs() != null ) {
+ ValidationJob j = new ValidationJob();
+ j.setDateCreated( new Date() );
+ j.setJobid("ERROR");
+ j.setValidationStatus(false);
+ j.setOutputLog( "Error from the OSOM Route builder Service" );
+ aProd.getValidationJobs().add(j);
+ }
+
+ exchange. getOut().setBody( aProd );
+ // copy attachements from IN to OUT to propagate them
+ //exchange.getOut().setAttachments(exchange.getIn().getAttachments());
+
+ }
+ };
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/lcm/LCMRulesController.java b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesController.java
new file mode 100644
index 0000000000000000000000000000000000000000..760874b7dd85a46912889432174c6c69dfd10617
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesController.java
@@ -0,0 +1,143 @@
+package org.etsi.osl.osom.lcm;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.etsi.osl.tmf.lcm.model.ELCMRulePhase;
+import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification;
+
+/**
+ * @author ctranoris
+ *
+ */
+@Service(value = "lcmRulesController")
+public class LCMRulesController {
+
+ private static final transient Log logger = LogFactory.getLog( LCMRulesController.class.getName() );
+
+ @Autowired
+ private ProducerTemplate template;
+
+
+ @Value("${CATALOG_GET_LCMRULE_BY_ID}")
+ private String CATALOG_GET_LCMRULE_BY_ID = "";
+
+
+ @Value("${CATALOG_GET_LCMRULES_BY_SPECID_PHASE}")
+ private String CATALOG_GET_LCMRULES_BY_SPECID_PHASE = "";
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ /**
+ * execute rules of a phase
+ * @param phase
+ * @param spec
+ * @param sor
+ * @param serviceToCreate
+ */
+ public LCMRulesExecutorVariables execPhase(ELCMRulePhase phase, LCMRulesExecutorVariables vars) {
+
+ logger.debug("In execPhase phase=" + phase
+ + ", spec name = " + vars.getSpec().getName()
+ + ", orderid = " + vars.getSorder().getId() );
+
+ List lcmspecs = retrieveLCMRulesOfSpecification_Phase( vars.getSpec().getId(), phase.getValue() );
+
+ if ( lcmspecs == null) {
+ logger.debug("No LCMRuleSpecs for phase="+ phase
+ + ", spec name = " + vars.getSpec().getName()
+ + ", orderid = " + vars.getSorder().getId() );
+ return vars;
+ }
+
+ for (LCMRuleSpecification lcmRuleSpecification : lcmspecs) {
+ logger.info("Prepare to execute LCMRuleSpecification =" + lcmRuleSpecification.getName() );
+ LCMRuleSpecification lcmspec = retrieveLCMRuleSpecificationById( lcmRuleSpecification.getId() );
+
+ LCMRulesExecutor lcmRulesExecutor = new LCMRulesExecutor();
+ vars = lcmRulesExecutor.executeLCMRuleCode(lcmspec, vars);
+ }
+
+ return vars;
+
+ }
+
+
+ /**
+ * get LCMRuleSpecification spec by id from model via bus
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public LCMRuleSpecification retrieveLCMRuleSpecificationById(String lcmspecid) {
+ logger.info("will retrieve LCMRuleSpecification from catalog lcmspecid=" + lcmspecid );
+
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_LCMRULE_BY_ID, lcmspecid);
+
+ if ( !(response instanceof String)) {
+ logger.error("LCMRuleSpecification object is wrong.");
+ return null;
+ }
+ LCMRuleSpecification ls = toJsonObj( (String)response, new TypeReference() {});
+
+ return ls;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Service Specification details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+
+ public List retrieveLCMRulesOfSpecification_Phase(String servicespecid, String phasename ) {
+ logger.info("will retrieveLCMRulesOfSpecification_Phase from catalog serviceSpecid=" + servicespecid );
+
+ try {
+
+ Map map = new HashMap<>();
+ map.put("servicespecid", servicespecid );
+ map.put("phasename", phasename );
+
+ Object response = template.
+ requestBodyAndHeaders( CATALOG_GET_LCMRULES_BY_SPECID_PHASE, "", map);
+
+ if ( !(response instanceof String)) {
+ logger.error("LCMRuleSpecifications objects are wrong.");
+ return null;
+ }
+
+ List ls = toJsonObj( (String)response,new TypeReference>() {} );
+
+ return ls;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Service Specification details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+
+ static T toJsonObj(String content, TypeReference valueType) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.readValue( content, valueType);
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..3a77c8ef553c605e684600de4420d367a792ec1f
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java
@@ -0,0 +1,248 @@
+package org.etsi.osl.osom.lcm;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification;
+
+/**
+ * @author ctranoris
+ *
+ */
+public class LCMRulesExecutor {
+
+ private static final transient Log logger = LogFactory.getLog( LCMRulesExecutor.class.getName() );
+
+ public LCMRulesExecutorVariables executeLCMRuleCode(LCMRuleSpecification lcmspec, LCMRulesExecutorVariables vars) {
+
+ logger.info("executeLCMRuleCode lcmspecId =" + lcmspec.getId() + "lcmspec =" + lcmspec.getName() );
+
+ //Prepare code
+ final String className = "ExecRule_"+lcmspec.getId().replace("-", "_");
+
+ String code=
+ //"package " + className + "; \n\n" +
+ "import org.etsi.osl.osom.lcm.LcmBaseExecutor;\n\n"
+ + "public class "+className+" extends LcmBaseExecutor{\n\n" +
+ """
+ @Override
+ public void exec() {
+ //SNIP STARTS
+ """
+ + preprocess( lcmspec.getCode() )
+ +"""
+ //SNIP ENDS
+ }
+ }
+
+ """;
+
+ logger.debug("code dump:");
+ logger.debug( code );
+ try {
+ vars = execudeCode(className, code, vars, lcmspec);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+
+
+
+
+ return vars;
+ }
+
+
+ /**
+ *
+ * Any code preprocessing before compilation
+ * @param aCode
+ * @return
+ */
+ private String preprocess(final String aCode) {
+ String newCode = aCode;
+ newCode = preprocess_ClearAllEVALVariables(aCode );
+ return newCode;
+ }
+
+
+ /**
+ *
+ * inside Strings we may have parameters from the code.
+ * The parameters are in the form $EVAL_param3_EVAL$
+ * They should be properly replaced inside the String
+ * @param newValue
+ * @return
+ */
+ private String preprocess_ClearAllEVALVariables(String newValue) {
+ String anewValue = newValue;
+ logger.debug("clearEVALVariables before " + newValue);
+
+ anewValue = anewValue.replace("$QUOTESTR$", "\"");
+// anewValue = anewValue.replace("$$XVALS_", " \"\"\" +");
+// anewValue = anewValue.replace("_XVALE$$", "+ \"\"\"\n");
+ anewValue = anewValue.replace("$$XVALS_", "\"+");
+ anewValue = anewValue.replace("_XVALE$$", "+\"");
+ logger.debug("clearEVALVariables after " + anewValue);
+ return anewValue;
+ }
+
+ /**
+ * @param className
+ * @param code
+ * @param vars
+ * @param lcmspec
+ * @return
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @throws SecurityException
+ * @throws NoSuchMethodException
+ * @throws InvocationTargetException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ */
+ private LCMRulesExecutorVariables execudeCode(String className, String code, LCMRulesExecutorVariables vars, LCMRuleSpecification lcmspec) throws IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // A temporary directory where the java code and class will be located
+ Path temp = Paths.get(System.getProperty("java.io.tmpdir"), "openslice", className);
+ Files.createDirectories(temp);
+
+ // Creation of the java source file
+ // You could also extends the SimpleJavaFileObject object as shown in the doc.
+ // See SimpleJavaFileObject at https://docs.oracle.com/javase/8/docs/api/javax/tools/JavaCompiler.html
+ Path javaSourceFile = Paths.get(temp.normalize().toAbsolutePath().toString(), className + ".java");
+ Files.write(javaSourceFile, code.getBytes());
+
+ logger.debug("For lcmspec " + lcmspec.getName() + " The java source file is located at "+javaSourceFile);
+ // Verification of the presence of the compilation tool archive
+ final String toolsJarFileName = "tools.jar";
+ final String javaHome = System.getProperty("java.home");
+ Path toolsJarFilePath = Paths.get(javaHome, "lib", toolsJarFileName);
+ if (!Files.exists(toolsJarFilePath)){
+ logger.warn( "The tools jar file ("+toolsJarFileName+") could not be found at ("+toolsJarFilePath+").");
+ }
+
+ // The compile part
+ // Definition of the files to compile
+ File[] files1 = {javaSourceFile.toFile()};
+
+ // Get the compiler
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ logger.debug("compiler = "+ compiler);
+ // Get the file system manager of the compiler
+ StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
+ // Create a compilation unit (files)
+ Iterable extends JavaFileObject> compilationUnits =
+ fileManager.getJavaFileObjectsFromFiles(Arrays.asList(files1));
+ // A feedback object (diagnostic) to get errors
+ DiagnosticCollector diagnostics = new DiagnosticCollector();
+ // Compilation unit can be created and called only once
+
+ List optionList = new ArrayList();
+ // set compiler's classpath to be same as the runtime's
+ /**
+ * this is a current solution found.
+ * We need here to add to classpath the jar with the classes, so that the compile can be performed in runtime.
+ * This is the location of the jar inside the running container
+ */
+
+ File classesJar = new File("/opt/openslice/lib/org.etsi.osl.osom-1.2.0-SNAPSHOT.jar");
+ if ( classesJar.exists() ) {
+ optionList.addAll(Arrays.asList("-classpath", classesJar.getAbsoluteFile().toString() ));
+ }
+ logger.debug("optionList = "+ optionList.toString());
+
+
+
+
+ JavaCompiler.CompilationTask task = compiler.getTask(
+ null,
+ fileManager,
+ diagnostics,
+ optionList,
+ null,
+ compilationUnits
+ );
+ logger.debug("task1 = "+ task);
+ // The compile task is called
+ task.call();
+ logger.debug("task2 = "+ task);
+ // Printing of any compile problems
+
+ for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {
+ String err = String.format("LCMRule: %s, Phase: %s -> Error on line %d in %s, %s, %s %n",
+ lcmspec.getName(),
+ lcmspec.getLcmrulephase() ,
+ diagnostic.getLineNumber(),
+ diagnostic.getSource(),
+ diagnostic.getCode(),
+ diagnostic.getMessage(null) );
+ logger.error( err );
+ vars.getCompileDiagnosticErrors().add(err);
+
+ }
+
+
+ logger.debug("task3 = "+ task);
+ if ( diagnostics.getDiagnostics().size()>0 ) {
+ logger.error("LCMRule:" + lcmspec.getName() + "execudeCode compile error. Will just return");
+ return vars;
+ }
+
+ // Close the compile resources
+ fileManager.close();
+
+ URL[] classpath = new URL[] { temp.toUri().toURL() };
+
+ if ( classesJar.exists() ) {
+ classpath = new URL[] { temp.toUri().toURL(), classesJar.toURI().toURL() };
+ }
+ logger.debug("classpath = "+ classpath.toString());
+
+
+ // Now that the class was created, we will load it and run it
+ ClassLoader classLoader = LCMRulesExecutor.class.getClassLoader();
+ logger.debug("classLoader = "+ classLoader);
+ @SuppressWarnings("resource")
+ URLClassLoader urlClassLoader = new URLClassLoader(
+ classpath,
+ classLoader);
+ Class javaDemoClass = urlClassLoader.loadClass(className);
+ logger.debug("javaDemoClass = "+ javaDemoClass);
+ Object obj = javaDemoClass.getDeclaredConstructor().newInstance();
+ logger.debug("obj = "+ obj);
+
+ Method method = javaDemoClass.getMethod("run", LCMRulesExecutorVariables.class, LCMRuleSpecification.class);
+ logger.debug("method = "+ method);
+ ArrayList methodArgs = new ArrayList();
+ methodArgs.add( vars );
+ methodArgs.add( lcmspec );
+
+ Object response = method.invoke(obj, methodArgs.toArray());
+ if ( response instanceof LCMRulesExecutorVariables ) {
+ return (LCMRulesExecutorVariables) response;
+ }
+
+ return vars;
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutorVariables.java b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutorVariables.java
new file mode 100644
index 0000000000000000000000000000000000000000..198e5b3f1b86c237597c1225990d79515da75029
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutorVariables.java
@@ -0,0 +1,55 @@
+package org.etsi.osl.osom.lcm;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceCreate;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import lombok.Data;
+
+/**
+ * @author ctranoris this class is used to pass object to execution and also
+ * store their results while they are affected by code execution
+ */
+@Data
+public class LCMRulesExecutorVariables {
+
+ private ServiceCreate serviceToCreate;
+ private ServiceUpdate serviceToUpdate;
+ private ServiceSpecification spec;
+ private ServiceOrder sorder;
+ private ServiceOrderItem soItem;
+ private Service service;
+ private List compileDiagnosticErrors;
+ private ServiceOrderManager serviceOrderManager;
+ private Map outParams;
+
+ /**
+ * @param spec
+ * @param sorder
+ * @param serviceToCreate
+ */
+ public LCMRulesExecutorVariables(ServiceSpecification spec,
+ ServiceOrder sorder,
+ ServiceOrderItem asoItem,
+ ServiceCreate serviceToCreate,
+ ServiceUpdate serviceToUpdate,
+ Service serviceInstance,
+ ServiceOrderManager aServiceOrderManager) {
+ this.serviceToCreate = serviceToCreate;
+ this.serviceToUpdate = serviceToUpdate;
+ this.spec = spec;
+ this.sorder = sorder;
+ this.soItem = asoItem;
+ this.service = serviceInstance;
+ this.serviceOrderManager = aServiceOrderManager;
+ this.compileDiagnosticErrors = new ArrayList<>();
+ this.outParams = new HashMap();
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/lcm/LcmBaseExecutor.java b/src/main/java/org/etsi/osl/osom/lcm/LcmBaseExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..fa11e710c598766c7a7d524a178731823f1707aa
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/lcm/LcmBaseExecutor.java
@@ -0,0 +1,1006 @@
+package org.etsi.osl.osom.lcm;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Consumer;
+
+import javax.net.ssl.SSLException;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.jayway.jsonpath.Configuration;
+import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.Option;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.partnerservices.GenericClient;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
+import org.springframework.web.reactive.function.client.WebClient;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.EValueType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification;
+import org.etsi.osl.tmf.prm669.model.RelatedParty;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecRelationship;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderCreate;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItemRelationship;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
+import reactor.core.publisher.Mono;
+
+/**
+ * @author ctranoris
+ *
+ *
+ */
+public abstract class LcmBaseExecutor {
+
+ private LCMRulesExecutorVariables vars;
+
+ private LCMRuleSpecification lcmspec;
+
+ private static final transient Log logger = LogFactory.getLog(LcmBaseExecutor.class.getName());
+
+ public LCMRulesExecutorVariables run(LCMRulesExecutorVariables variables, LCMRuleSpecification lcmspec) {
+ this.vars = variables;
+ this.lcmspec = lcmspec;
+ try {
+ this.exec();
+ } catch (Exception e) {
+ vars.getCompileDiagnosticErrors().add(e.getLocalizedMessage());
+ e.printStackTrace();
+ }
+ return this.vars;
+ }
+
+ /**
+ * this is overriden
+ */
+ public abstract void exec();
+
+ private void testF() {
+
+ }
+
+
+
+
+ /**
+ * @return the vars
+ */
+ public LCMRulesExecutorVariables getVars() {
+ return vars;
+ }
+
+ /**
+ * @param vars the vars to set
+ */
+ public void setVars(LCMRulesExecutorVariables vars) {
+ this.vars = vars;
+ }
+
+ /**
+ * @return the lcmspec
+ */
+ public LCMRuleSpecification getLcmspec() {
+ return lcmspec;
+ }
+
+ /**
+ * @param lcmspec the lcmspec to set
+ */
+ public void setLcmspec(LCMRuleSpecification lcmspec) {
+ this.lcmspec = lcmspec;
+ }
+
+ public String getCharValFromStringType(String charName) {
+ logger.debug("getCharValFromStringType " + charName);
+ Optional c = getCharacteristicByName(charName);
+
+ if (c.isPresent()) {
+ String ttext = c.get().getValue().getValue();
+ logger.debug("getCharValFromStringType size = " + ttext );
+ logger.debug("getCharValFromStringType " + ttext);
+ System.out.println("The value is : \n " + ttext);
+ return c.get().getValue().getValue();
+ }
+
+ logger.debug("getCharValFromStringType NULL ");
+ return null;
+
+ }
+
+ private Optional getCharacteristicByName(String charName) {
+
+ List serviceCharacteristic;
+ if (lcmspec.getLcmrulephase().equals("PRE_PROVISION") || this.vars.getService() == null) {
+ serviceCharacteristic = this.vars.getServiceToCreate().getServiceCharacteristic();
+ } else { // use as input the running service in all other phases!
+ serviceCharacteristic = new ArrayList<>(this.vars.getService().getServiceCharacteristic());
+ }
+
+ logger.debug("getCharacteristicByName " + charName);
+ if (serviceCharacteristic != null) {
+ for (Characteristic c : serviceCharacteristic) {
+ if (c.getName().equals(charName)) {
+ if (c.getValue() != null) {
+ if (c.getValue().getValue() != null) {
+ return Optional.of(c);
+ }
+ }
+ }
+ }
+ }
+ Characteristic z = null;
+ return Optional.ofNullable(z);
+ }
+
+ public void setCharValFromStringType(String charName, String newValue) {
+ logger.debug("setCharValFromStringType " + charName + " = " + newValue);
+ Optional c = getCharacteristicByName(charName);
+
+ if ( c.isPresent() ) {
+ c.ifPresent(val -> val.getValue().setValue(newValue));
+ copyCharacteristicToServiceToUpdate(c.get());
+ } else { //will add a new characteristic if this does not exist
+ logger.debug(" setCharValFromStringType will add a new characteristic since this does not exist: " + charName + " = " + newValue);
+ Characteristic newC = new Characteristic();
+ newC.setName( charName );
+ newC.setValue( new Any(newValue, ""));
+ newC.setValueType("TEXT");
+ copyCharacteristicToServiceToUpdate( newC );
+ }
+
+ }
+
+ private void copyCharacteristicToServiceToUpdate(Characteristic characteristic) {
+
+ if ( this.vars.getServiceToUpdate() != null ) {
+ this.vars.getServiceToUpdate().addServiceCharacteristicItem( characteristic );
+ }else if ( this.vars.getServiceToCreate() != null ) {
+ this.vars.getServiceToCreate().addServiceCharacteristicItem( characteristic );
+ }
+
+ }
+
+ public void setCharValNumber(String charName, int newValue) {
+
+ logger.debug("setCharValNumber " + charName + " = " + newValue);
+ Optional c = getCharacteristicByName(charName);
+
+ if ( c.isPresent() ) {
+ c.ifPresent(val -> val.getValue().setValue("" + newValue));
+ copyCharacteristicToServiceToUpdate(c.get());
+ } else { //will add a new characteristic if this does not exist
+ logger.debug(" setCharValNumber will add a new characteristic since this does not exist: " + charName + " = " + newValue);
+ Characteristic newC = new Characteristic();
+ newC.setName( charName );
+ newC.setValue( new Any(newValue, ""));
+ newC.setValueType("NUMBER");
+ copyCharacteristicToServiceToUpdate( newC );
+ }
+ }
+
+ public int getCharValNumber(String charName) {
+ logger.debug("getCharValNumber " + charName);
+ Optional c = getCharacteristicByName(charName);
+
+ if (c.isPresent()) {
+ logger.debug("getCharValNumber " + c.get().getValue().getValue());
+ if (c.get().getValueType().equals(EValueType.BINARY.getValue())) {
+ int i = Integer.parseInt(c.get().getValue().getValue());
+ return i;
+ } else if (c.get().getValueType().equals(EValueType.ENUM.getValue())) {
+ int i = Integer.parseInt(c.get().getValue().getValue());
+ return i;
+ } else if (c.get().getValueType().equals(EValueType.INTEGER.getValue())) {
+ int i = Integer.parseInt(c.get().getValue().getValue());
+ return i;
+ } else if (c.get().getValueType().equals(EValueType.lONGINT.getValue())) {
+ int i = Integer.parseInt(c.get().getValue().getValue());
+ return i;
+ } else if (c.get().getValueType().equals(EValueType.SMALLINT.getValue())) {
+ int i = Integer.parseInt(c.get().getValue().getValue());
+ return i;
+ }
+ }
+
+ logger.debug("getCharValNumber NULL ");
+ return -1;
+ }
+
+ public String getCharValAsString(String charName) {
+ logger.debug("getCharValAsString " + charName);
+ Optional c = getCharacteristicByName(charName);
+
+ if (c.isPresent()) {
+ logger.debug("getCharValAsString " + c.get().getValue().getValue());
+ return c.get().getValue().getValue();
+ }
+
+ logger.debug("getCharValAsString NULL ");
+ return null;
+
+ }
+
+ public Boolean getCharValFromBooleanType(String charName) {
+ logger.debug("getCharValFromBooleanType " + charName);
+ Optional c = getCharacteristicByName(charName);
+
+ if (c.isPresent() && c.get().getValue() != null) {
+ logger.debug("getCharValFromBooleanType " + c.get().getValue().getValue());
+
+ return c.get().getValue().getValue().toUpperCase().equals("TRUE");
+ }
+
+ logger.debug("getCharValFromBooleanType NULL ");
+ return false;
+
+ }
+
+ public void setCharValFromBooleanType(String charName, boolean newValue) {
+
+ logger.debug("setCharValFromBooleanType " + charName + " = " + newValue);
+ Optional c = getCharacteristicByName(charName);
+
+ if ( c.isPresent() ) {
+ c.ifPresent(val -> val.getValue().setValue("" + newValue));
+ copyCharacteristicToServiceToUpdate(c.get());
+ } else { //will add a new characteristic if this does not exist
+ logger.debug(" setCharacteristicOfCurrentService will add a new characteristic since this does not exist: " + charName + " = " + newValue);
+ Characteristic newC = new Characteristic();
+ newC.setName( charName );
+ newC.setValue( new Any("" + newValue, ""));
+ newC.setValueType("TEXT");
+ copyCharacteristicToServiceToUpdate( newC );
+ }
+ }
+
+ /**
+ *
+ * example setCharValNumber("Director return channel to cameras", 1);
+ * setCharValFromSetType("cirros_2vnf_nsd::Primitive::fsetup",
+ * "[{\"value\":\"1\",\"alias\":\"member_vnf_index\"},{\"value\":\"fsetup\",\"alias\":\"primitive\"},{\"value\":\"{
+ * \\\"tvg\\\": { \\\"ip\\\": \\\"\\\", \\\"channel1\\\": { \\\"mode\\\":
+ * \\\"0\\\" } } }\",\"alias\":\"confjson\"}]");
+ *
+ * @param charName
+ * @param newValue
+ */
+ public void setCharValFromSetType(String charName, String newValue) {
+
+ logger.debug("setCharValFromBooleanType " + charName + " = " + newValue);
+ Optional c = getCharacteristicByName(charName);
+
+ if ( c.isPresent() ) {
+ c.ifPresent(val -> val.getValue().setValue(newValue));
+ copyCharacteristicToServiceToUpdate(c.get());
+ } else { //will add a new characteristic if this does not exist
+ logger.debug(" setCharacteristicOfCurrentService will add a new characteristic since this does not exist: " + charName + " = " + newValue);
+ Characteristic newC = new Characteristic();
+ newC.setName( charName );
+ newC.setValue( new Any(newValue, ""));
+ newC.setValueType("TEXT");
+ copyCharacteristicToServiceToUpdate( newC );
+ }
+
+ }
+
+ public List getCharValFromSetType(String charName) {
+ logger.debug("getCharValFromSetType " + charName);
+ Optional c = getCharacteristicByName(charName);
+
+// if (lcmspec.getLcmrulephase().equals("PRE_PROVISION") || this.vars.getService() == null) {
+// serviceCharacteristic = this.vars.getServiceToCreate().getServiceCharacteristic();
+// } else { // use as input the running service in all other phases!
+// serviceCharacteristic = new ArrayList<>(this.vars.getService().getServiceCharacteristic());
+// }
+
+ if (c.isPresent() && c.get().getValue() != null) {
+ logger.debug("getCharValFromSetType " + c.get().getValue().getValue());
+
+ String val = c.get().getValue().getValue();
+
+ List as = null;
+ try {
+ as = toJsonObj(val, new TypeReference>() {
+ });
+ logger.debug("getCharValFromSetType " + as.toString());
+
+ ArrayList asret = new ArrayList<>();
+ for (Any any : as) {
+ asret.add(any.getValue());
+ }
+ return asret;
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ logger.debug("getCharValFromSetType NULL ");
+ return null;
+ }
+
+ public boolean checkIfSetContainsValue(List charValFromSetType, String value) {
+
+ if (charValFromSetType != null) {
+ for (String s : charValFromSetType) {
+ if (s.equals(value))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void logtext(String txt) {
+ logger.info("From LCM Rule Log: " + txt);
+ }
+
+ public WebClient getAwebClient(String baseurl, String clientRegId, String aOAUTH2CLIENTID, String aOAUTHSECRET,
+ String scopes, String aTOKEURI, String aUSERNAME, String aPASSWORD) {
+ logger.info(baseurl);
+
+ String[] aOAUTHscopes = null;
+ if (scopes != null) {
+ aOAUTHscopes = scopes.split(";");
+ }
+
+ GenericClient oac = new GenericClient(
+
+ clientRegId, aOAUTH2CLIENTID, aOAUTHSECRET, aOAUTHscopes, aTOKEURI, aUSERNAME, aPASSWORD, baseurl);
+
+ try {
+ WebClient webClient;
+ webClient = oac.createWebClient();
+ return webClient;
+ } catch (SSLException e) {
+ logger.error(e.getLocalizedMessage());
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public String rest_block(String verb, String eurl, String headers, String apayload) {
+ return rest_block(verb, eurl, headers, apayload, null, null, null, null, null, null, null);
+
+ }
+
+ public String rest_block(String verb, String eurl, String headers, String apayload, String baseurl,
+ String aOAUTH2CLIENTID, String aOAUTHSECRET, String scopes, String aTOKEURI, String aUSERNAME,
+ String aPASSWORD) {
+
+ logger.debug(String.format(
+ "verb: %s\n eurl: %s\n headers: %s\n apayload: %s\n baseurl: %s\n aOAUTH2CLIENTID: %s\n aOAUTHSECRET: %s\n scopes: %s\n aTOKEURI: %s\n aUSERNAME: %s\n ",
+ verb, eurl, headers, apayload, baseurl, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI, aUSERNAME,
+ aPASSWORD));
+
+
+ System.out.println("============================================================================= \n");
+ System.out.println("The value length is apayload= \n" + apayload.length());
+ System.out.println("The value is apayload= \n" + apayload);
+ System.out.println("============================================================================= \n");
+
+ if (baseurl != null) {
+ eurl = eurl.replace(baseurl, ""); // remove the baseurl if present
+ }
+
+ Consumer httpHeaders = (t) -> {
+ if (headers != null) {
+ String[] hs = headers.split(";");
+ for (String headervals : hs) {
+ String[] ah = headervals.split("=");
+ t.add(ah[0], ah[1]);
+ }
+ }
+
+ };
+
+ if (verb.equals("GET")) {
+ return rest_block_GET(eurl, httpHeaders, apayload, baseurl, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI,
+ aUSERNAME, aPASSWORD);
+ } else if (verb.equals("POST")) {
+ return rest_block_POST(eurl, httpHeaders, apayload, baseurl, aOAUTH2CLIENTID, aOAUTHSECRET, scopes,
+ aTOKEURI, aUSERNAME, aPASSWORD);
+ } else if (verb.equals("PUT")) {
+ return rest_block_PUT(eurl, httpHeaders, apayload, baseurl, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI,
+ aUSERNAME, aPASSWORD);
+ } else if (verb.equals("PATCH")) {
+ return rest_block_PATCH(eurl, httpHeaders, apayload, baseurl, aOAUTH2CLIENTID, aOAUTHSECRET, scopes,
+ aTOKEURI, aUSERNAME, aPASSWORD);
+ } else if (verb.equals("DELETE")) {
+ return rest_block_DELETE(eurl, httpHeaders, apayload, baseurl, aOAUTH2CLIENTID, aOAUTHSECRET, scopes,
+ aTOKEURI, aUSERNAME, aPASSWORD);
+ }
+
+ return null;
+ }
+
+ public String rest_block_GET(String eurl, Consumer httpHeaders, String apayload, String baseurl,
+ String aOAUTH2CLIENTID, String aOAUTHSECRET, String scopes, String aTOKEURI, String aUSERNAME,
+ String aPASSWORD) {
+
+ String clientRegId = "lcmBaseExecutor_WebClient";
+ WebClient webclient = getAwebClient(baseurl, clientRegId, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI,
+ aUSERNAME, aPASSWORD);
+ String aresponse = null;
+ if (webclient != null) {
+
+ try {
+ aresponse = webclient.get().uri(eurl).headers(httpHeaders).retrieve()
+ .onStatus( HttpStatusCode::is4xxClientError , response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ }).onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ }).bodyToMono(new ParameterizedTypeReference() {
+ }).block();
+
+ } catch (Exception e) {
+ logger.error(" error on web client request for " + eurl);
+ e.printStackTrace();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ } else {
+ logger.error("WebClient is null. Cannot be created for " + eurl);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ return aresponse;
+ }
+
+ public String rest_block_POST(String eurl, Consumer httpHeaders, String apayload, String baseurl,
+ String aOAUTH2CLIENTID, String aOAUTHSECRET, String scopes, String aTOKEURI, String aUSERNAME,
+ String aPASSWORD) {
+ String clientRegId = "lcmBaseExecutor_WebClient";
+ WebClient webclient = getAwebClient(baseurl, clientRegId, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI,
+ aUSERNAME, aPASSWORD);
+ String aresponse = null;
+ if (webclient != null) {
+
+ try {
+ aresponse = webclient.post().uri(eurl).headers(httpHeaders).bodyValue(apayload).retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ }).onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ }).bodyToMono(new ParameterizedTypeReference() {
+ }).block();
+
+ } catch (Exception e) {
+ logger.error(" error on web client request for " + eurl);
+ e.printStackTrace();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ } else {
+ logger.error("WebClient is null. Cannot be created for " + eurl);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ return aresponse;
+ }
+
+ public String rest_block_PUT(String eurl, Consumer httpHeaders, String apayload, String baseurl,
+ String aOAUTH2CLIENTID, String aOAUTHSECRET, String scopes, String aTOKEURI, String aUSERNAME,
+ String aPASSWORD) {
+ String clientRegId = "lcmBaseExecutor_WebClient";
+ WebClient webclient = getAwebClient(baseurl, clientRegId, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI,
+ aUSERNAME, aPASSWORD);
+ String aresponse = null;
+ if (webclient != null) {
+
+ try {
+ aresponse = webclient.put().uri(eurl).headers(httpHeaders).bodyValue(apayload).retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ }).onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ }).bodyToMono(new ParameterizedTypeReference() {
+ }).block();
+
+ } catch (Exception e) {
+ logger.error(" error on web client request for " + eurl);
+ e.printStackTrace();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ } else {
+ logger.error("WebClient is null. Cannot be created for " + eurl);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ return aresponse;
+ }
+
+ public String rest_block_PATCH(String eurl, Consumer httpHeaders, String apayload, String baseurl,
+ String aOAUTH2CLIENTID, String aOAUTHSECRET, String scopes, String aTOKEURI, String aUSERNAME,
+ String aPASSWORD) {
+ String clientRegId = "lcmBaseExecutor_WebClient";
+ WebClient webclient = getAwebClient(baseurl, clientRegId, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI,
+ aUSERNAME, aPASSWORD);
+ String aresponse = null;
+ if (webclient != null) {
+
+ try {
+ aresponse = webclient.patch().uri(eurl).headers(httpHeaders).bodyValue(apayload).retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ }).onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ }).bodyToMono(new ParameterizedTypeReference() {
+ }).block();
+
+ } catch (Exception e) {
+ logger.error(" error on web client request for " + eurl);
+ e.printStackTrace();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ } else {
+ logger.error("WebClient is null. Cannot be created for " + eurl);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ return aresponse;
+ }
+
+ public String rest_block_DELETE(String eurl, Consumer httpHeaders, String apayload, String baseurl,
+ String aOAUTH2CLIENTID, String aOAUTHSECRET, String scopes, String aTOKEURI, String aUSERNAME,
+ String aPASSWORD) {
+ String clientRegId = "lcmBaseExecutor_WebClient";
+ WebClient webclient = getAwebClient(baseurl, clientRegId, aOAUTH2CLIENTID, aOAUTHSECRET, scopes, aTOKEURI,
+ aUSERNAME, aPASSWORD);
+ String aresponse = null;
+ if (webclient != null) {
+
+ try {
+ aresponse = webclient.delete().uri(eurl).headers(httpHeaders).retrieve()
+ .onStatus( HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ }).onStatus( HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ }).bodyToMono(new ParameterizedTypeReference() {
+ }).block();
+
+ } catch (Exception e) {
+ logger.error(" error on web client request for " + eurl);
+ e.printStackTrace();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ } else {
+ logger.error("WebClient is null. Cannot be created for " + eurl);
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ return aresponse;
+ }
+
+ public String getCurrentServiceOrderPropValue(String propertyName, String... props) {
+
+ logger.debug("getCurrentServiceOrderPropValue propertyName=" + propertyName);
+ ServiceOrder serviceOrder = this.vars.getSorder();
+ if (serviceOrder == null) {
+ return null;
+ }
+
+ switch (propertyName) {
+ case "state":
+ return serviceOrder.getState().name();
+ case "id":
+ return serviceOrder.getId();
+ case "externaId":
+ return serviceOrder.getExternalId();
+ case "serviceOrderObjectasJSON":
+ try {
+ return toJsonString(serviceOrder);
+ } catch (IOException e) {
+ logger.error(e.getLocalizedMessage());
+ e.printStackTrace();
+ }
+ default:
+ break;
+ }
+
+ return "";
+ }
+
+ public String getCurrentServicePropValue(String propertyName, String... props) {
+
+ logger.debug("getCurrentServicePropValue propertyName=" + propertyName);
+ Service service = this.vars.getService();
+ if (service == null) {
+ return null;
+ }
+
+ return getServicePropValue(service, propertyName, props);
+ }
+
+ public String getFromPayloadServicePropValue(String jsonpayload, String propertyName, String... props) {
+
+ logger.debug("getFromPayloadServicePropValue propertyName=" + propertyName);
+
+ Service service = null;
+ try {
+ service = toJsonObj(jsonpayload, new TypeReference() {
+ });
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+
+ if (service == null) {
+ return null;
+ }
+
+ return getServicePropValue(service, propertyName, props);
+ }
+
+ private String getServicePropValue(Service service, String propertyName, String... props) {
+ switch (propertyName) {
+ case "state":
+ return service.getState().name();
+ case "name":
+ return service.getName();
+ case "hasStarted":
+ return service.isHasStarted().toString();
+ case "isServiceEnabled":
+ return service.isIsServiceEnabled().toString();
+ case "serviceType":
+ return service.getServiceType();
+ case "startMode":
+ return service.getStartMode();
+ case "serviceCharacteristicValue":
+ if (props != null && props.length > 0) {
+ Characteristic cp = service.getServiceCharacteristicByName(props[0]);
+ logger.debug("getFromPayloadServicePropValue propertyName=" + propertyName + ',' + props[0]);
+ if (cp != null && cp.getValue() != null) {
+ return cp.getValue().getValue();
+ }
+ }
+ break;
+ case "serviceOrderID":
+ if (service.getServiceOrder() != null) {
+ return service.getServiceOrder().stream().findFirst().get().getId();
+ }
+ break;
+ case "serviceSpecificationID":
+ if (service.getServiceSpecificationRef() != null) {
+ return service.getServiceSpecificationRef().getId();
+ }
+ break;
+ case "serviceObjectasJSON":
+ try {
+ return toJsonString(service);
+ } catch (IOException e) {
+ logger.error(e.getLocalizedMessage());
+ e.printStackTrace();
+ }
+ default:
+ break;
+ }
+
+ return "";
+ }
+
+
+ public String getServiceRefPropValue(String serviceName, String propertyName, String... props) {
+
+ logger.debug("getServiceRefPropValue propertyName=" + propertyName);
+ Service ctxService = this.vars.getService();
+ if (ctxService == null) {
+ return "";
+ }
+
+ @NotNull @Valid ServiceRef refSrvice = null;
+
+ for (ServiceRef sr : ctxService.getSupportingService()) {
+ if ( sr.getName().equals(serviceName) ) {
+ refSrvice = sr;
+ }
+ }
+
+ if (refSrvice == null) {
+ return "";
+ }
+
+ if (this.vars.getServiceOrderManager() != null) {
+ Service aService = this.vars.getServiceOrderManager().retrieveService( refSrvice.getId() );
+ if ( aService!= null) {
+ return getServicePropValue(aService, propertyName, props);
+ }
+ }
+
+
+ return "";
+ }
+
+
+
+ //createServiceRefIf("Bundle B", getServiceRefPropValue("BundleA", "state", "").equals("active")==true);
+ public boolean createServiceRefIf(String serviceName, boolean b) {
+
+ logger.debug( String.format("createServiceRefwhen serviceName=%s = %s", serviceName, b ) );
+
+
+ String serviceIDToCheckDependcy=null;
+ for (ServiceSpecRelationship specRels : this.vars.getSpec().getServiceSpecRelationship()) {
+ if ( specRels.getName().equals(serviceName) ) {
+ serviceIDToCheckDependcy = specRels.getId();
+ }
+ }
+
+
+ if (serviceIDToCheckDependcy != null) {
+ this.vars.getOutParams().put( serviceIDToCheckDependcy, Boolean.toString(b) );
+ }
+
+ return false;
+ }
+
+
+ public String createServiceOrder(String sorderJson) {
+
+ logger.debug("createServiceOrder sorderJson=" + sorderJson);
+ ServiceOrder contextServiceOrder = this.vars.getSorder();
+ try {
+ ServiceOrderCreate sonew = toJsonObj(sorderJson, new TypeReference() {
+ });
+
+ sonew.setRequestedStartDate(contextServiceOrder.getRequestedStartDate());
+ sonew.setRequestedCompletionDate(contextServiceOrder.getRequestedCompletionDate());
+ sonew.getOrderItem().stream().findFirst().get().setState(ServiceOrderStateType.ACKNOWLEDGED); // will be
+ // processed
+ // immediately
+ // by OSOM
+
+ if (this.vars.getSoItem() != null) {
+ ServiceOrderItemRelationship soitemrel = new ServiceOrderItemRelationship();
+ ;
+ soitemrel.setId(this.vars.getSoItem().getId());
+ soitemrel.setRelationshipType("DEPENDENCY");
+ sonew.getOrderItem().stream().findFirst().get().addOrderItemRelationshipItem(soitemrel);
+ }
+
+ if (sonew.getRelatedParty() == null) {
+ RelatedParty rp = new RelatedParty();
+ rp.setName("OSOM LCM");
+ rp.setRole("REQUESTER");
+ sonew.addRelatedPartyItem(rp);
+ }
+
+ if (sonew.getNote() == null) {
+ Note n = new Note();
+ if (this.vars.getSorder() != null) {
+ n.setText(String.format("Order created by LCM rule, %s, of orderid = %s", this.lcmspec.getName(),
+ this.vars.getSorder().getId()));
+ } else {
+ n.setText(String.format("Order created by LCM rule, %s", this.lcmspec.getName()));
+ }
+ sonew.addNoteItem(n);
+ }
+
+ if (this.vars.getServiceOrderManager() != null) {
+ ServiceOrder scorder = this.vars.getServiceOrderManager().createServiceOrder(sonew);
+ return toJsonString(scorder);
+ } else {
+
+ logger.error("createServiceOrder serviceOrderManager is NULL!");
+ }
+
+ } catch (IOException e) {
+ logger.error("createServiceOrder error=" + e.getLocalizedMessage());
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public void setCharacteristicOfCurrentService(String charName, String newValue) {
+ logger.debug("setCharacteristicOfCurrentService " + charName + " = " + newValue);
+ Optional c = getCharacteristicByName(charName);
+
+ if ( c.isPresent() ) {
+ c.ifPresent(val -> val.getValue().setValue(newValue));
+ copyCharacteristicToServiceToUpdate(c.get());
+ } else { //will add a new characteristic if this does not exist
+ logger.debug(" setCharacteristicOfCurrentService will add a new characteristic since this does not exist: " + charName + " = " + newValue);
+ Characteristic newC = new Characteristic();
+ newC.setName( charName );
+ newC.setValue( new Any(newValue, ""));
+ newC.setValueType("TEXT");
+ copyCharacteristicToServiceToUpdate( newC );
+ }
+
+ }
+
+ public String getJsonValueAsStringFromField(String jsonval, String fieldName) {
+ //logger.debug("getJsonValueAsStringFromField " + fieldName + " . jsonval=" + jsonval);
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ JsonNode rootNode = mapper.readTree( jsonval );
+ JsonNode ret = rootNode.get(fieldName);
+ if ( ret !=null && ret.isValueNode()) {
+ return ret.asText("");
+ }
+ return ret.toPrettyString();
+ } catch (JsonProcessingException e) {
+
+ logger.error("getJsonValueAsStringFromField failed! " + fieldName + " . jsonval=" + jsonval);
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+ public String getElementInJsonArrayFromIndex(String jsonval, int index) {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ JsonNode rootNode = mapper.readTree( jsonval );
+
+ if (rootNode.isArray() ) {
+ ArrayNode jarr = (ArrayNode)rootNode;
+ if (index value = JsonPath.using( conf ).parse( jsonval ).read(jsonpath );
+
+ if ( value == null ) {
+ return "";
+ }else if ( value.size() == 1 ) {
+ return value.get(0).toString() ;
+ } else if ( value.size()>1 ) {
+ return value.toString() ;
+ }else {
+ return "";
+ }
+
+ }catch (Exception e) {
+
+ logger.error("getValueFromJsonPath failed! jsonpath=" + jsonpath + " . jsonval=" + jsonval);
+ e.printStackTrace();
+ }
+
+ return "";
+ }
+
+ static T toJsonObj(String content, TypeReference typeReference) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.readValue(content, typeReference);
+ }
+
+ static String toJsonString(Object object) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.writeValueAsString(object);
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/AlarmsService.java b/src/main/java/org/etsi/osl/osom/management/AlarmsService.java
new file mode 100644
index 0000000000000000000000000000000000000000..ec21c95c2864d7b286fcd56ecbd88bc4d7d89a74
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/AlarmsService.java
@@ -0,0 +1,115 @@
+package org.etsi.osl.osom.management;
+
+import java.io.IOException;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import org.etsi.osl.tmf.am642.model.AlarmCreate;
+import org.etsi.osl.tmf.am642.model.AlarmStateType;
+import org.etsi.osl.tmf.am642.model.AlarmUpdate;
+import org.etsi.osl.tmf.am642.model.Comment;
+
+@Service
+public class AlarmsService {
+
+ private static final transient Log logger = LogFactory.getLog(AlarmsService.class.getName());
+
+ @Autowired
+ CamelContext contxt;
+
+ @Autowired
+ ProducerTemplate template;
+
+ @Value("${ALARMS_ADD_ALARM}")
+ private String ALARMS_ADD_ALARM ="";
+
+ @Value("${ALARMS_UPDATE_ALARM}")
+ private String ALARMS_UPDATE_ALARM ="";
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ /**
+ * update the alarm status in alarm repo
+ * @param cleared
+ *
+ * @param alarm
+ * @param canBehandled
+ * @param actions
+ */
+ public void patchAlarmClear(String alarmId, String textNote, boolean cleared ) {
+ AlarmUpdate aupd = new AlarmUpdate();
+ Comment comment = new Comment();
+ comment.setTime(OffsetDateTime.now(ZoneOffset.UTC));
+ comment.setSystemId(compname);
+
+ if ( cleared ) {
+ aupd.setClearSystemId( compname );
+ comment.setComment("Alarm cleared by applying actions." + textNote);
+ aupd.setState(AlarmStateType.cleared.name());
+ } else {
+ comment.setComment("Alarm updated, not cleared." + textNote);
+ }
+
+
+
+ aupd.addCommentItem(comment);
+
+ try {
+ logger.info("Alarm id = " + alarmId + "." + comment.getComment());
+ String response = this.updateAlarm(aupd, alarmId);
+ logger.info("Alarm id updated = " + response.toString() );
+ } catch (IOException e) {
+ logger.error("patchAlarmClear Alarm id = " + alarmId );
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param al
+ * @return a response in string
+ * @throws IOException
+ */
+ public String createAlarm(AlarmCreate al) throws IOException {
+
+ String body;
+ body = toJsonString(al);
+ logger.info("createAlarm body = " + body);
+ Object response = template.requestBody( ALARMS_ADD_ALARM, body);
+ return response.toString();
+ }
+
+ /**
+ * @param al
+ * @return a response in string
+ * @throws IOException
+ */
+ public String updateAlarm(AlarmUpdate al, String alarmid) throws IOException {
+
+ String body;
+ body = toJsonString(al);
+ logger.info("updateAlarm body = " + body);
+ Object response = template.requestBodyAndHeader( ALARMS_UPDATE_ALARM, body , "alarmid", alarmid);
+ return response.toString();
+ }
+
+
+
+ static String toJsonString(Object object) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.writeValueAsString(object);
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/AutomationCheck.java b/src/main/java/org/etsi/osl/osom/management/AutomationCheck.java
new file mode 100644
index 0000000000000000000000000000000000000000..1e8fc763c03c5e9fb14acfc21d0f5eb44c0380eb
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/AutomationCheck.java
@@ -0,0 +1,123 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.UserPartRoleType;
+import org.etsi.osl.tmf.prm669.model.RelatedParty;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.EServiceStartMode;
+import org.etsi.osl.tmf.sim638.model.Service;
+
+/**
+ * @author ctranoris
+ * this one will process one ServiceOrderItem of a specific serviceorder
+ */
+@Component(value = "automationCheck") // bean name
+public class AutomationCheck implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(AutomationCheck.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("AutomationCheck:" + execution.getVariableNames().toString());
+ execution.setVariable("brokeActivity", "MANUALLY" );
+
+ ServiceSpecification spec = null;
+ String contextServiceSpecId = (String) execution.getVariable("contextServiceSpecId");
+ if ( contextServiceSpecId != null ) {
+ spec = serviceOrderManager.retrieveServiceSpec(contextServiceSpecId);
+ } else {
+ return;
+ }
+
+ Service contextService = null;
+ String contextServiceId = (String) execution.getVariable("contextServiceId");
+ if ( contextServiceId != null ) {
+ contextService = serviceOrderManager.retrieveService(contextServiceId);
+ }else {
+ return;
+ }
+
+
+ execution.setVariable("brokeActivity", "MANUALLY" );
+
+ if ( contextService.getStartMode().equals( EServiceStartMode.AUTOMATICALLY_MANAGED.getValue() ) ) {
+
+ execution.setVariable("brokeActivity", "AUTO" ); //the default action
+
+ if (fromPartnerOrganization(spec) != null ) {
+ execution.setVariable("brokeActivity", "PARTNER" );
+ } else if ( ( spec.findSpecCharacteristicByName( "testSpecRef" ) != null ) ) {
+ execution.setVariable("brokeActivity", "TESTSPEC" );
+ } else if ( spec.getType().equals("ResourceFacingServiceSpecification") && ( spec.findSpecCharacteristicByName( "OSM_NSDCATALOGID" ) != null ) ) {
+ execution.setVariable("brokeActivity", "RFS_OSM" );
+ } else if ( spec.getType().equals("ResourceFacingServiceSpecification") && ( spec.findSpecCharacteristicByName( "_CR_SPEC" ) != null ) ) {
+ execution.setVariable("brokeActivity", "RFS_CRSPEC" );
+ }
+ }
+
+
+// ServiceUpdate supd = new ServiceUpdate();
+//
+// Note noteItem = new Note();
+// noteItem.setText("Service will be handled by " + execution.getVariable("brokeActivity" ));
+//
+// noteItem.setAuthor( compname );
+//
+// supd.addNoteItem(noteItem);
+// serviceOrderManager.updateService( contextService.getId() , supd, false);
+
+
+
+ }
+
+
+ private RelatedParty fromPartnerOrganization(ServiceSpecification specrel) {
+ if ( specrel.getRelatedParty() != null ) {
+ for (RelatedParty rp : specrel.getRelatedParty()) {
+ if ( rp.getRole().equals( UserPartRoleType.ORGANIZATION.getValue() )) {
+ return rp;
+ }
+ }
+ }
+ return null;
+ }
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/CROrchestrationCheckDeploymentService.java b/src/main/java/org/etsi/osl/osom/management/CROrchestrationCheckDeploymentService.java
new file mode 100644
index 0000000000000000000000000000000000000000..364aa98b0f0bc1dcdb68b53893b0c56c5673b801
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/CROrchestrationCheckDeploymentService.java
@@ -0,0 +1,176 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.model.DeploymentDescriptorStatus;
+import org.etsi.osl.model.DeploymentDescriptorVxFInstanceInfo;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.ResourceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.ri639.model.Resource;
+import org.etsi.osl.tmf.ri639.model.ResourceStatusType;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import jakarta.validation.Valid;
+
+
+@Component(value = "crOrchestrationCheckDeploymentService") //bean name
+public class CROrchestrationCheckDeploymentService implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(CROrchestrationCheckDeploymentService.class.getName());
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info( "CROrchestrationCheckDeploymentService" );
+ logger.info( execution.getVariableNames().toString() );
+
+
+ if ( execution.getVariable("contextServiceId") == null) {
+
+ logger.error( "Variable contextServiceId is NULL!" );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE );
+ return;
+ }
+ Service aService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+
+ if ( aService == null ) {
+ logger.info( "aService is null for contextServiceId = " +(String) execution.getVariable("contextServiceId") );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE );
+ return;
+ }
+
+
+ execution.setVariable("serviceDeploymentFinished", Boolean.FALSE );
+
+
+ ServiceUpdate supd = new ServiceUpdate();
+ boolean propagateToSO = false;
+
+ //retrieve the related supporting resource by id and check its status
+ //ResourceRef supresourceRef = aService.getSupportingResource().stream().findFirst().get();//we assume for now we have only one related resource
+
+ @Valid
+ ServiceStateType nextState = aService.getState() ;
+ boolean allActive = aService.getSupportingResource().size() > 0 ;
+ boolean allTerminated = aService.getSupportingResource().size() > 0 ;
+ boolean existsInactive=false;
+ boolean existsTerminated=false;
+ boolean existsReserved=false;
+ for ( ResourceRef supresourceRef : aService.getSupportingResource()) {
+ Resource res = serviceOrderManager.retrieveResource( supresourceRef.getId() );
+ if ( res == null ) {
+ supd.setState( ServiceStateType.TERMINATED);
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE);
+ Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, propagateToSO );
+ return;
+ }
+
+
+
+ if ( res.getResourceStatus() != null ) {
+ switch (res.getResourceStatus()) {
+ case AVAILABLE: {
+ nextState = ServiceStateType.ACTIVE;
+ break;
+ }
+ case STANDBY: {
+ nextState = ServiceStateType.RESERVED;
+ break;
+ }
+ case SUSPENDED: {
+ nextState = ServiceStateType.INACTIVE;
+ break;
+ }
+ case RESERVED: {
+ nextState = ServiceStateType.RESERVED;
+ break;
+ }
+ case UNKNOWN: {
+ if (aService.getState().equals( ServiceStateType.ACTIVE )) {
+ nextState = ServiceStateType.TERMINATED;
+ }
+ break;
+ }
+ case ALARM: {
+ nextState = ServiceStateType.INACTIVE;
+ break;
+ }
+ default:
+ throw new IllegalArgumentException("Unexpected value: " + res.getResourceStatus());
+ }
+ }
+
+ allActive = allActive && nextState == ServiceStateType.ACTIVE;
+ allTerminated = allTerminated && nextState == ServiceStateType.TERMINATED;
+ existsInactive = existsInactive || nextState == ServiceStateType.INACTIVE;
+ existsTerminated = existsTerminated || nextState == ServiceStateType.TERMINATED;
+ existsReserved = existsReserved || nextState == ServiceStateType.RESERVED;
+
+
+ }
+
+
+ if ( allActive ) {
+ supd.setState( ServiceStateType.ACTIVE );
+ } else if ( allTerminated ) {
+ supd.setState( ServiceStateType.TERMINATED );
+ } else if ( existsInactive ) {
+ supd.setState( ServiceStateType.INACTIVE );
+ } else if ( existsReserved ) {
+ supd.setState( ServiceStateType.RESERVED );
+ } else if ( existsTerminated ) {
+ supd.setState( ServiceStateType.INACTIVE );
+ }
+
+ Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, propagateToSO );
+
+ if ( serviceResult!= null ) {
+ if ( serviceResult.getState().equals(ServiceStateType.ACTIVE)
+ || serviceResult.getState().equals(ServiceStateType.TERMINATED)) {
+
+ logger.info("Deployment Status OK. Service state = " + serviceResult.getState() );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE);
+ return;
+ }
+ }
+ logger.info("Wait For Deployment Status. ");
+
+
+
+
+
+ }
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/CROrchestrationService.java b/src/main/java/org/etsi/osl/osom/management/CROrchestrationService.java
new file mode 100644
index 0000000000000000000000000000000000000000..3f6ca2248a86cfd0e47ca41d8215d8c6dbdc2015
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/CROrchestrationService.java
@@ -0,0 +1,244 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ResourceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef;
+import org.etsi.osl.tmf.ri639.model.Resource;
+import org.etsi.osl.tmf.ri639.model.ResourceCreate;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+
+
+@Component(value = "crOrchestrationService") // bean name
+public class CROrchestrationService implements JavaDelegate {
+
+ private static final transient Log logger =
+ LogFactory.getLog(CROrchestrationService.class.getName());
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("CROrchestrationService");
+ logger.info("VariableNames:" + execution.getVariableNames().toString());
+ logger.info("orderid:" + execution.getVariable("orderid").toString());
+ logger.info("contextServiceId:" + execution.getVariable("contextServiceId").toString());
+
+ try {
+
+
+ ServiceUpdate su = new ServiceUpdate();// the object to update the service
+ Note noteItem = new Note();
+ noteItem.setText("");
+
+ if (execution.getVariable("contextServiceId") instanceof String contextServiceId) {
+
+
+
+ ServiceOrder sorder =
+ serviceOrderManager.retrieveServiceOrder(execution.getVariable("orderid").toString());
+ Service aService =
+ serviceOrderManager.retrieveService( contextServiceId );
+ logger.info("Service name:" + aService.getName());
+ logger.info("Service state:" + aService.getState());
+ logger.info("Request for a Custom Resource creation for Service: " + aService.getId());
+
+ // we need to retrieve here the Service Spec of this service
+
+ ServiceSpecification spec =
+ serviceOrderManager.retrieveServiceSpec(aService.getServiceSpecificationRef().getId());
+
+ if (spec != null) {
+
+ ServiceSpecCharacteristic c = spec.getServiceSpecCharacteristicByName("_CR_SPEC");
+ String crspec = c.getDefaultValue();
+ Characteristic servicecrspec = aService.getServiceCharacteristicByName("_CR_SPEC");
+ if (servicecrspec != null) {
+ crspec = servicecrspec.getValue().getValue();
+ }
+
+ //we need to get the equivalent resource spec. since ServiceSpec is an RFS
+ ResourceSpecificationRef rSpecRef = spec.getResourceSpecification().stream().findFirst().get();
+ //we will create a resource based on the values of resourcepsecificationRef
+ Resource resourceCR = createRelatedResource( rSpecRef, sorder, aService );
+ ResourceRef rr = new ResourceRef();
+ rr.setId( resourceCR.getId() );
+ rr.setName( resourceCR.getName());
+ rr.setType( resourceCR.getType());
+ su.addSupportingResourceItem( rr );
+
+ String response = null;
+ if (crspec != null) {
+ response = createNewDeploymentRequest(aService, resourceCR, sorder.getId(), sorder.getStartDate(),
+ sorder.getExpectedCompletionDate(), sorder.getId(), crspec);
+ }
+
+ if ( response!=null && response.equals("OK")) {
+ su.setState(ServiceStateType.RESERVED);
+ Note successNoteItem = new Note();
+ successNoteItem.setText(String.format("Requesting CRIDGE to deploy crspec"));
+ successNoteItem.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString());
+ successNoteItem.setAuthor(compname);
+ su.addNoteItem(successNoteItem);
+ } else {
+ su.setState(ServiceStateType.TERMINATED);
+ Note errNoteItem = new Note();
+ errNoteItem.setText(String.format("Requesting CRIDGE to deploy crspec failed with message: " + response));
+ errNoteItem.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString());
+ errNoteItem.setAuthor(compname);
+ su.addNoteItem(errNoteItem);
+ }
+ Service supd = serviceOrderManager.updateService(aService.getId(), su, false);
+
+ return;
+
+ } else {
+
+ logger.error("Cannot retrieve ServiceSpecification for service :"
+ + (String) execution.getVariable("contextServiceId"));
+ }
+ } else {
+ logger.error("Cannot retrieve variable contextServiceId");
+ }
+
+ // if we get here something is wrong so we need to terminate the service.
+
+
+
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+
+
+ try {
+ Note noteItem = new Note();
+ noteItem.setText("Request to CR FAILED." + noteItem.getText());
+ noteItem.setAuthor(compname);
+ noteItem.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString());
+ ServiceUpdate su = new ServiceUpdate();// the object to update the service
+ su.addNoteItem(noteItem);
+ su.setState(ServiceStateType.TERMINATED);
+ serviceOrderManager.updateService(execution.getVariable("contextServiceId").toString(), su,
+ false);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+
+ private Resource createRelatedResource(ResourceSpecificationRef rSpecRef, ServiceOrder sOrder, Service aService) {
+
+ ResourceCreate resCreate = new ResourceCreate();
+ resCreate.setName( "_cr_tmpname_service_" + aService.getId() );
+ resCreate.setStartOperatingDate( aService.getStartDate() );
+ resCreate.setEndOperatingDate(aService.getEndDate());
+ ResourceSpecificationRef rSpecRefObj = new ResourceSpecificationRef() ;
+ rSpecRefObj.id(rSpecRef.getId())
+ .name( rSpecRef.getName())
+ .setType(rSpecRef.getType());
+ resCreate.setResourceSpecification(rSpecRefObj);
+ return serviceOrderManager.createResource( resCreate, sOrder, rSpecRef.getId() );
+
+
+
+ }
+
+
+ private String createNewDeploymentRequest(Service aService, Resource resourceCR, String orderId,
+ OffsetDateTime startDate,
+ OffsetDateTime endDate, String orderid, String _CR_SPEC) {
+
+ try {
+ Map map = new HashMap<>();
+ map.put("currentContextCluster",getServiceCharacteristic(aService, "currentContextCluster") );
+ map.put("clusterMasterURL",getServiceCharacteristic(aService, "clusterMasterURL") );
+ map.put("org.etsi.osl.serviceId", aService.getId() );
+ map.put("org.etsi.osl.resourceId", resourceCR.getId() );
+ map.put("org.etsi.osl.prefixName", "cr" + resourceCR.getId().substring(0, 8) );
+ map.put("org.etsi.osl.serviceOrderId", orderId );
+ map.put("org.etsi.osl.namespace", orderId );
+ map.put("org.etsi.osl.statusCheckFieldName", getServiceCharacteristic(aService, "_CR_CHECK_FIELD") );
+ map.put("org.etsi.osl.statusCheckValueStandby", getServiceCharacteristic(aService, "_CR_CHECKVAL_STANDBY") );
+ map.put("org.etsi.osl.statusCheckValueAlarm", getServiceCharacteristic(aService, "_CR_CHECKVAL_ALARM") );
+ map.put("org.etsi.osl.statusCheckValueAvailable", getServiceCharacteristic(aService, "_CR_CHECKVAL_AVAILABLE") );
+ map.put("org.etsi.osl.statusCheckValueReserved", getServiceCharacteristic(aService, "_CR_CHECKVAL_RESERVED") );
+ map.put("org.etsi.osl.statusCheckValueUnknown", getServiceCharacteristic(aService, "_CR_CHECKVAL_UNKNOWN") );
+ map.put("org.etsi.osl.statusCheckValueSuspended", getServiceCharacteristic(aService, "_CR_CHECKVAL_SUSPENDED") );
+
+ String response = serviceOrderManager.cridgeDeploymentRequest( map, _CR_SPEC);
+ int retries = 0;
+ while ( response.equals("SEE OTHER")) {
+ response = serviceOrderManager.cridgeDeploymentRequest( map, _CR_SPEC);
+ Thread.sleep(1000);
+ retries++;
+ if (retries>100) { //will support maximum 100 registered CRIDGE in queue
+ break;
+ }
+ }
+ return response;
+
+ } catch (Exception e) {
+ logger.error("cridgeDeploymentRequest failed");
+ e.printStackTrace();
+ }
+
+ return null;
+
+ }
+
+
+ private Object getServiceCharacteristic(Service aService, String val) {
+ if (aService.getServiceCharacteristicByName( val ) !=null ) {
+ return aService.getServiceCharacteristicByName( val ).getValue().getValue();
+ }
+ return "";
+ }
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/CheckServiceTestDeployment.java b/src/main/java/org/etsi/osl/osom/management/CheckServiceTestDeployment.java
new file mode 100644
index 0000000000000000000000000000000000000000..84a2b71af47596f472d91599cd5dc2225ee0c41b
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/CheckServiceTestDeployment.java
@@ -0,0 +1,197 @@
+package org.etsi.osl.osom.management;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.EValueType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.stm653.model.CharacteristicSpecification;
+import org.etsi.osl.tmf.stm653.model.CharacteristicValueSpecification;
+import org.etsi.osl.tmf.stm653.model.ServiceTest;
+import org.etsi.osl.tmf.stm653.model.ServiceTestCreate;
+import org.etsi.osl.tmf.stm653.model.ServiceTestSpecification;
+import org.etsi.osl.tmf.stm653.model.ServiceTestSpecificationRef;
+import jakarta.validation.Valid;
+
+@Component(value = "checkServiceTestDeployment") //bean name
+public class CheckServiceTestDeployment implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( CheckServiceTestDeployment.class.getName());
+
+ @Value("${spring.application.name}")
+ private String compname;
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Override
+ public void execute(DelegateExecution execution) {
+ logger.info( "checkServiceTestDeployment" );
+ logger.debug( execution.getVariableNames().toString() );
+
+ execution.setVariable("serviceTestDeploymentFinished", false );
+ Service aService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+ logger.debug("Check checkServiceTestDeployment Service name:" + aService.getName() );
+ logger.debug("Request checkServiceTestDeployment for Service id: " + aService.getId() );
+
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );
+
+ ServiceSpecCharacteristic charc = spec.findSpecCharacteristicByName( "testSpecRef" );
+
+ ServiceUpdate supd = new ServiceUpdate();
+ supd.setState( ServiceStateType.TERMINATED); //by default if something goes wrong
+
+ if ( charc != null ) {
+ String sTestId = charc.getDefaultValue();
+ logger.debug("checkServiceTestDeployment will create Service Test Spec with id: " + sTestId );
+ ServiceTestSpecification serviceTestSpec = serviceOrderManager.retrieveServiceTestSpec(sTestId);
+ if ( serviceTestSpec != null ) {
+
+ //1. create test instance
+ ServiceOrder sorder = serviceOrderManager.retrieveServiceOrder( execution.getVariable("orderid").toString() );
+ ServiceTestCreate sTCreate = new ServiceTestCreate();
+ String servicename = spec.getName();
+ sTCreate.setDescription("A Service Test for " + servicename );
+
+ sTCreate.setName( servicename );
+ sTCreate.setState( ServiceStateType.ACTIVE.name());
+ ServiceTestSpecificationRef testRef = new ServiceTestSpecificationRef();
+ testRef.setId(sTestId);
+ sTCreate.setTestSpecification(testRef );
+ ServiceRef serviceRef = new ServiceRef();
+ serviceRef.setId( aService.getId());
+ sTCreate.setRelatedService(serviceRef );
+ sTCreate.characteristic( new ArrayList<>());
+
+
+ for (Characteristic serviceChar : aService.getServiceCharacteristic() ) {
+ org.etsi.osl.tmf.stm653.model.Characteristic newChar = new org.etsi.osl.tmf.stm653.model.Characteristic();
+ newChar.setName( serviceChar.getName() );
+ newChar.setValueType( serviceChar.getValueType() );
+ newChar.setValue( new Any(
+ serviceChar.getValue().getValue(),
+ serviceChar.getValue().getAlias()) );
+ sTCreate.addCharacteristicItem( newChar );
+ }
+
+ copyRemainingSpecCharacteristicsToServiceCharacteristic (serviceTestSpec, sTCreate.getCharacteristic()) ;
+
+
+ ServiceTest createdServiceTest = serviceOrderManager.createServiceTest(sTCreate , sorder, serviceTestSpec);
+
+
+
+
+ //update parent service
+ if ( createdServiceTest!=null) {
+ //2. reference testintance in supd
+ for (Characteristic c : aService.getServiceCharacteristic()) {
+ supd.addServiceCharacteristicItem( c );
+ }
+ Characteristic serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "testInstanceRef" );
+
+ String serviceTestInstanceID= createdServiceTest.getId() ;
+ serviceCharacteristicItem.setValue( new Any( serviceTestInstanceID ));
+ supd.addServiceCharacteristicItem(serviceCharacteristicItem);
+ supd.setState( ServiceStateType.ACTIVE);
+ }
+
+ }
+ }
+
+
+
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+ execution.setVariable("serviceTestDeploymentFinished", true );
+
+ }
+
+ private void copyRemainingSpecCharacteristicsToServiceCharacteristic(ServiceTestSpecification sourceSpec, @Valid List list) {
+
+
+ for (CharacteristicSpecification sourceCharacteristic : sourceSpec.getSpecCharacteristic()) {
+ if ( sourceCharacteristic.getValueType() != null ) {
+ boolean charfound = false;
+ for (org.etsi.osl.tmf.stm653.model.Characteristic destchar : list) {
+ if ( destchar.getName().equals(sourceCharacteristic.getName())) {
+ charfound = true;
+ break;
+ }
+ }
+
+ if (!charfound) {
+
+ org.etsi.osl.tmf.stm653.model.Characteristic newChar = new org.etsi.osl.tmf.stm653.model.Characteristic();
+ newChar.setName( sourceCharacteristic.getName() );
+ newChar.setValueType( sourceCharacteristic.getValueType() );
+
+ if ( sourceCharacteristic.getValueType() != null && sourceCharacteristic.getValueType().equals( EValueType.ARRAY.getValue() ) ||
+ sourceCharacteristic.getValueType() != null && sourceCharacteristic.getValueType().equals( EValueType.SET.getValue() ) ) {
+ String valString = "";
+ for (CharacteristicValueSpecification specchar : sourceCharacteristic.getCharacteristicValueSpecification() ) {
+ if ( ( specchar.isIsDefault()!= null) && specchar.isIsDefault() ) {
+ if ( !valString.equals("")) {
+ valString = valString + ",";
+ }
+ valString = valString + "{\"value\":\"" + specchar.getValue().getValue() + "\",\"alias\":\"" + specchar.getValue().getAlias() + "\"}";
+ }
+
+ }
+
+ newChar.setValue( new Any( "[" + valString + "]", "") );
+
+
+ } else {
+ for (CharacteristicValueSpecification specchar : sourceCharacteristic.getCharacteristicValueSpecification()) {
+ if ( ( specchar.isIsDefault()!= null) && specchar.isIsDefault() ) {
+ newChar.setValue( new Any(
+ specchar.getValue().getValue(),
+ specchar.getValue().getAlias()) );
+ break;
+ }else {
+ if (specchar.isIsDefault()== null){
+
+ logger.info("specchar is null value: " + sourceCharacteristic.getName() );
+ }
+ }
+
+ }
+ }
+
+ //sourceCharacteristic.getServiceSpecCharacteristicValue()
+
+ if ( newChar.getValue() !=null) {
+ list.add(newChar );
+ } else {
+ newChar.setValue( new Any(
+ "",
+ "") );
+ list.add(newChar );
+ }
+
+ }
+
+ }
+
+
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/CreateReservedService.java b/src/main/java/org/etsi/osl/osom/management/CreateReservedService.java
new file mode 100644
index 0000000000000000000000000000000000000000..042353e75033d59219b789325eabc1e0d01ac021
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/CreateReservedService.java
@@ -0,0 +1,481 @@
+package org.etsi.osl.osom.management;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.etsi.osl.osom.lcm.LCMRulesExecutorVariables;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.EValueType;
+import org.etsi.osl.tmf.common.model.UserPartRoleType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceRelationship;
+import org.etsi.osl.tmf.common.model.service.ServiceSpecificationRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.lcm.model.ELCMRulePhase;
+import org.etsi.osl.tmf.prm669.model.RelatedParty;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristicValue;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.EServiceStartMode;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceCreate;
+import org.etsi.osl.tmf.sim638.model.ServiceOrderRef;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+import jakarta.validation.Valid;
+
+@Component(value = "createReservedService") // bean name
+public class CreateReservedService implements JavaDelegate {
+ private static final transient Log logger = LogFactory.getLog( CreateReservedService.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("CreateReservedService:" + execution.getVariableNames().toString());
+
+
+ String serviceSpecID = (String) execution.getVariable("serviceSpecID"); //here we get the parent contextservice
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( serviceSpecID );
+
+ if ( spec == null ) {
+ return;
+ }
+
+ Service parentService = null;
+ String parentServiceId = (String) execution.getVariable("parentServiceId"); //here we get the parent contextservice
+ if ( parentServiceId != null ) {
+ parentService = serviceOrderManager.retrieveService(parentServiceId);
+ }
+
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderid"));
+
+ logger.debug("Examine service items");
+ String orderItemIdToProcess = (String) execution.getVariable("orderItemId");
+ ServiceOrderItem soi = null;
+
+ for (ServiceOrderItem i : sor.getOrderItem()) {
+ if (i.getUuid().equals( orderItemIdToProcess )){
+ soi = i;
+ break;
+ }
+ }
+
+ if ( soi == null ) {
+ return;
+ }
+
+
+
+ // get service spec by id from model via bus, find if bundle and analyze its
+ // related services
+
+ logger.debug("Retrieved Service ID:" + spec.getId());
+ logger.debug("Retrieved Service Name:" + spec.getName());
+
+
+ //this is a main underlying service for the requested service (restriction)
+ Service createdUnderlService = addServicesToVariables( spec, sor, soi, parentService );
+
+ soi.getService().setState( ServiceStateType.RESERVED );
+ soi.setState(ServiceOrderStateType.INPROGRESS);
+
+ /***
+ * we can update now the serviceorder element in catalog
+ * Update also the related service attributes
+ */
+
+ ServiceOrderUpdate serviceOrderUpd = new ServiceOrderUpdate();
+ for (ServiceOrderItem orderItemItem : sor.getOrderItem()) {
+ orderItemItem.getService().setName( orderItemItem.getService().getServiceSpecification().getName() );
+ orderItemItem.getService().setCategory( orderItemItem.getService().getServiceSpecification().getType() );
+ //orderItemItem.getService().setState( ServiceStateType.RESERVED );
+ //orderItemItem.setAction( ServiceOrderActionType.NOCHANGE ); //reset the action to NOCHANGE
+
+ serviceOrderUpd.addOrderItemItem(orderItemItem);
+ }
+
+ Note noteItem = new Note();
+ noteItem.setText( String.format( "Create Reserved Service for %s " , spec.getName() ) );
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ noteItem.setAuthor( compname );
+ serviceOrderUpd.addNoteItem( noteItem );
+
+ execution.setVariable("contextServiceId", createdUnderlService.getId() );
+ execution.setVariable("contextServiceSpecId", spec.getId() );
+ serviceOrderManager.updateServiceOrderOrder( sor.getId(), serviceOrderUpd );
+ }
+
+
+ /**
+ *
+ * This method decides the kind of Automation to be applied for a requested Service
+ * e.g. Manual, Automated, Handled by NFVO, Handled by External partner.
+ * It creates an underlying service definition that needs to be managed next by various Activities/Processes
+ *
+ *
+ * @param specrel
+ * @param sor
+ * @param soi
+ * @param servicesHandledByExternalSP
+ * @param servicesHandledManual
+ * @param servicesHandledByNFVOAutomated
+ * @param servicesLocallyAutomated
+ * @param parentService
+ * @return
+ */
+ private Service addServicesToVariables(ServiceSpecification specrel,
+ ServiceOrder sor, ServiceOrderItem soi,
+ Service parentService) {
+
+ logger.debug("\tService spec name :" + specrel.getName());
+ logger.debug("\tService spec type :" + specrel.getType());
+
+ Service createdServ = null;
+ RelatedParty partnerOrg = fromPartnerOrganization( specrel );
+
+
+ if ( partnerOrg != null ) {
+ createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, partnerOrg, parentService);
+
+
+ }
+ else if (specrel.getType().equals("ResourceFacingServiceSpecification")) {
+ createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService);
+
+ } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.isIsBundle()!=null) && specrel.isIsBundle() ) {
+ createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService);
+
+ } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.findSpecCharacteristicByName("OSAUTOMATED") != null ) ) {
+ createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService);
+
+ } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.findSpecCharacteristicByName("testSpecRef") != null ) ) {
+ createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService);
+
+ }
+ else {
+ createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.MANUALLY_BY_SERVICE_PROVIDER, null, parentService);
+ }
+
+ //add now the serviceRef
+ if ( createdServ!=null ) {
+ ServiceRef supportingServiceRef = new ServiceRef();
+ supportingServiceRef.setId( createdServ.getId() );
+ supportingServiceRef.setReferredType( createdServ.getName() );
+ supportingServiceRef.setName( createdServ.getName() );
+ soi.getService().addSupportingServiceItem(supportingServiceRef );
+
+ if ( parentService!= null) {
+ addCreatedServiceAsSupportingServiceToParent( parentService, supportingServiceRef );
+ }
+
+
+ return createdServ;
+
+ } else {
+ logger.error("Service was not created for spec: " + specrel.getName());
+ }
+
+ return null;
+
+ }
+
+
+ /**
+ *
+ * Adds a supportingServiceRef to the Supporting Services of createdUnderlService
+ *
+ * @param parentService
+ * @param supportingServiceRef
+ */
+ private void addCreatedServiceAsSupportingServiceToParent(Service parentService,
+ ServiceRef supportingServiceRef) {
+
+
+ parentService.addSupportingServiceItem(supportingServiceRef);
+
+ ServiceUpdate supd = new ServiceUpdate();
+
+ for (ServiceRef existingSupportingServices : parentService.getSupportingService() ) {
+ supd.addSupportingServiceItem(existingSupportingServices);
+ }
+
+ serviceOrderManager.updateService( parentService.getId() , supd, false);
+
+
+ }
+
+
+ /**
+ * @param sor
+ * @param soi
+ * @param spec
+ * @return
+ */
+ private Service createServiceByServiceSpec(ServiceOrder sor, ServiceOrderItem soi,
+ ServiceSpecification spec, EServiceStartMode startMode,
+ RelatedParty partnerOrg, Service parentService) {
+
+ ServiceCreate serviceToCreate = new ServiceCreate();
+ String servicename = spec.getName();
+ serviceToCreate.setDescription("A Service for " + spec.getName());
+ if ( partnerOrg!= null ) {
+ servicename = partnerOrg.getName() + "::" + servicename + "::PROXY";
+ serviceToCreate.setDescription("A Service for " + spec.getName() + " offered by external partner: " + partnerOrg.getName());
+ }
+
+ serviceToCreate.setName( servicename );
+ serviceToCreate.setCategory(spec.getType().replace("Specification", "") );
+ serviceToCreate.setType(spec.getType().replace("Specification", ""));
+ serviceToCreate.setServiceDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ serviceToCreate.setStartDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ serviceToCreate.setEndDate( sor.getExpectedCompletionDate() );
+ serviceToCreate.hasStarted(false);
+ serviceToCreate.setIsServiceEnabled(false);
+ serviceToCreate.setStartMode( startMode.getValue() );
+
+ Note noteItem = new Note();
+ noteItem.setText("Service Created by CreateReservedService");
+
+ noteItem.setAuthor( compname );
+ serviceToCreate.addNoteItem(noteItem);
+
+ ServiceOrderRef serviceOrderref = new ServiceOrderRef();
+ serviceOrderref.setId( sor.getId() );
+ serviceOrderref.setServiceOrderItemId( soi.getId() );
+ serviceToCreate.addServiceOrderItem(serviceOrderref );
+
+ ServiceSpecificationRef serviceSpecificationRef = new ServiceSpecificationRef();
+ serviceSpecificationRef.setId( spec.getId());
+ serviceSpecificationRef.setName(spec.getName());
+ serviceToCreate.setServiceSpecificationRef(serviceSpecificationRef );
+
+ serviceToCreate.setServiceType( spec.getName());
+ serviceToCreate.setState( ServiceStateType.RESERVED );
+
+
+ if (spec.getRelatedParty()!=null) {
+ for (RelatedParty rp : spec.getRelatedParty()) {
+ rp.setUuid(null);
+ serviceToCreate.addRelatedPartyItem(rp);
+ }
+ }
+
+ //we need to be careful here with the bundle and the related Service Specs, to properly propagate the rules inside
+ //first copy into the newly created service any characteristic values from the order
+ for (ServiceSpecCharacteristic c : spec.getServiceSpecCharacteristic()) {
+
+ boolean characteristicFound = false;
+ for (Characteristic orderCharacteristic : soi.getService().getServiceCharacteristic()) {
+ String specCharacteristicToSearch = spec.getName() + "::" +c.getName();
+ if ( orderCharacteristic.getName().equals( specCharacteristicToSearch )) { //copy only characteristics that are related from the order
+ serviceToCreate.addServiceCharacteristicItem( addServiceCharacteristicItem(c, orderCharacteristic) );
+ characteristicFound = true;
+ break;
+ }
+ }
+
+ if (!characteristicFound) { //fallback to find simple name (i.e. not starting with service spec name)
+ for (Characteristic orderCharacteristic : soi.getService().getServiceCharacteristic()) {
+ String specCharacteristicToSearch = c.getName();
+ if ( orderCharacteristic.getName().equals( specCharacteristicToSearch )) { //copy only characteristics that are related from the order
+
+ serviceToCreate.addServiceCharacteristicItem( addServiceCharacteristicItem(c, orderCharacteristic) );
+ characteristicFound = true;
+ break;
+ }
+ }
+
+ }
+
+ }
+
+ if ( serviceToCreate.getServiceCharacteristic() == null ) {
+ serviceToCreate.setServiceCharacteristic( new ArrayList<>() );
+ }
+ copyRemainingSpecCharacteristicsToServiceCharacteristic(spec ,serviceToCreate.getServiceCharacteristic() ); //copy to service the rest of the characteristics that do not exists yet from the above search
+
+
+ if ( parentService != null ) { //if parentService is not Null, then we need the value of the corresponding characteristic from the parent into this service
+ for (Characteristic cchild : serviceToCreate.getServiceCharacteristic() ) {
+ for (Characteristic c : parentService.getServiceCharacteristic() ) {
+ String childCharacteristicToMatch = serviceToCreate.getName() + "::" +cchild.getName();
+ if ( c.getName().equals( childCharacteristicToMatch )) { //assign only characteristics values that are related from the parent service
+ cchild.getValue().setValue( c.getValue().getValue() );
+ break;
+ }
+ }
+ }
+
+
+ //also add parent service as relationship to parent
+ ServiceRelationship srelationship = new ServiceRelationship();
+ ServiceRef parentServiceRef = new ServiceRef();
+ parentServiceRef.setId( parentService.getId() );
+ parentServiceRef.setReferredType( parentService.getName() );
+ parentServiceRef.setName( parentService.getName() );
+ srelationship.setRelationshipType("ChildService");
+ srelationship.setService(parentServiceRef);
+
+ serviceToCreate.addServiceRelationshipItem( srelationship );
+
+ }
+
+
+// :execute any LCM rules "PRE_PROVISION" phase for the SPEC;
+ LCMRulesExecutorVariables vars = new LCMRulesExecutorVariables(spec, sor, soi, serviceToCreate, null , null, serviceOrderManager);
+
+ logger.debug("===============BEFORE lcmRulesController.execPhase for spec:" + spec.getName() + " =============================");
+ vars = lcmRulesController.execPhase( ELCMRulePhase.PRE_PROVISION, vars );
+
+ //logger.debug("vars= " + vars );
+ logger.debug("===============AFTER lcmRulesController.execPhase =============================");
+
+ if ( vars.getCompileDiagnosticErrors().size()>0 ) {
+ noteItem = new Note();
+ String msg = "LCM Rule execution error by AutomationCheck. ";
+ for (String tmsg : vars.getCompileDiagnosticErrors()) {
+ msg = msg + "\n"+ tmsg;
+ }
+ noteItem.setText( msg );
+ noteItem.setAuthor( compname );
+ vars.getServiceToCreate().addNoteItem(noteItem);
+ }
+
+ Service createdService = serviceOrderManager.createService(
+ vars.getServiceToCreate() ,
+ vars.getSorder(),
+ spec);
+ return createdService;
+ }
+
+
+
+ private RelatedParty fromPartnerOrganization(ServiceSpecification specrel) {
+ if ( specrel.getRelatedParty() != null ) {
+ for (RelatedParty rp : specrel.getRelatedParty()) {
+ if ( rp.getRole().equals( UserPartRoleType.ORGANIZATION.getValue() )) {
+ return rp;
+ }
+ }
+ }
+ return null;
+ }
+
+ private Characteristic addServiceCharacteristicItem(ServiceSpecCharacteristic c, Characteristic orderCharacteristic) {
+ Characteristic serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( c.getName() );
+ serviceCharacteristicItem.setValueType( c.getValueType() );
+
+ Any val = new Any();
+ val.setValue( orderCharacteristic.getValue().getValue() );
+ val.setAlias( orderCharacteristic.getValue().getAlias() );
+
+ serviceCharacteristicItem.setValue( val );
+
+ return serviceCharacteristicItem;
+ }
+
+ /**
+ *
+ * will copy any remaining service spec characteristics that where not included in the initial order
+ *
+ * @param sourceSpecID
+ * @param destServiceCharacteristic
+ */
+ private void copyRemainingSpecCharacteristicsToServiceCharacteristic(ServiceSpecification sourceSpec, @Valid List destServiceCharacteristic) {
+
+
+ for (ServiceSpecCharacteristic sourceCharacteristic : sourceSpec.getServiceSpecCharacteristic()) {
+ if ( sourceCharacteristic.getValueType() != null ) {
+ boolean charfound = false;
+ for (Characteristic destchar : destServiceCharacteristic) {
+ if ( destchar.getName().equals(sourceCharacteristic.getName())) {
+ charfound = true;
+ break;
+ }
+ }
+
+ if (!charfound) {
+
+ Characteristic newChar = new Characteristic();
+ newChar.setName( sourceCharacteristic.getName() );
+ newChar.setValueType( sourceCharacteristic.getValueType() );
+
+ if ( sourceCharacteristic.getValueType() != null && sourceCharacteristic.getValueType().equals( EValueType.ARRAY.getValue() ) ||
+ sourceCharacteristic.getValueType() != null && sourceCharacteristic.getValueType().equals( EValueType.SET.getValue() ) ) {
+ String valString = "";
+ for (ServiceSpecCharacteristicValue specchar : sourceCharacteristic.getServiceSpecCharacteristicValue()) {
+ if ( ( specchar.isIsDefault()!= null) && specchar.isIsDefault() ) {
+ if ( !valString.equals("")) {
+ valString = valString + ",";
+ }
+ valString = valString + "{\"value\":\"" + specchar.getValue().getValue() + "\",\"alias\":\"" + specchar.getValue().getAlias() + "\"}";
+ }
+
+ }
+
+ newChar.setValue( new Any( "[" + valString + "]", "") );
+
+
+ } else {
+ for (ServiceSpecCharacteristicValue specchar : sourceCharacteristic.getServiceSpecCharacteristicValue()) {
+ if ( ( specchar.isIsDefault()!= null) && specchar.isIsDefault() ) {
+ newChar.setValue( new Any(
+ specchar.getValue().getValue(),
+ specchar.getValue().getAlias()) );
+ break;
+ }else {
+ if (specchar.isIsDefault()== null){
+
+ logger.info("specchar is null value: " + sourceCharacteristic.getName() );
+ }
+ }
+
+ }
+ }
+
+ //sourceCharacteristic.getServiceSpecCharacteristicValue()
+
+ if ( newChar.getValue() !=null) {
+ destServiceCharacteristic.add(newChar );
+ } else {
+ newChar.setValue( new Any(
+ "",
+ "") );
+ destServiceCharacteristic.add(newChar );
+ }
+
+ }
+
+ }
+
+
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/DependencyRulesSolver.java b/src/main/java/org/etsi/osl/osom/management/DependencyRulesSolver.java
new file mode 100644
index 0000000000000000000000000000000000000000..9902fb1253501d07f20a5b921bf9618602236bc2
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/DependencyRulesSolver.java
@@ -0,0 +1,110 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.dmn.engine.DmnEngine;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+/**
+ * @author ctranoris
+ *
+ */
+@Component(value = "dependencyRulesSolver") // bean name
+public class DependencyRulesSolver {
+
+ private static final transient Log logger = LogFactory.getLog(NFVOrchestrationService.class.getName());
+
+ @Autowired
+ private DmnEngine dmnEngine;
+
+// @Autowired
+// private DmnRuleService ruleService;
+
+ /**
+ * @param sorder is the containing order to resolve
+ * @param specRequested
+ * @return
+ */
+ public Map get(ServiceOrder sorder, ServiceSpecification specRequested) {
+ Map variables = new HashMap();
+ for (ServiceOrderItem soi : sorder.getOrderItem()) {
+ if ( (soi.getService() != null) && ( soi.getService().getServiceCharacteristic() != null ) ) {
+ for (Characteristic c : soi.getService().getServiceCharacteristic()) {
+ variables.put(c.getName().replace(" ", "_").replace(":", "_") , c.getValue().getValue() );
+ }
+ }
+
+ }
+
+// File initialFile = new File("src/test/resources/ondemand_decisions.dmn");
+// InputStream targetStream;
+ try {
+// targetStream = new FileInputStream(initialFile);
+//
+// XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+// XMLStreamReader xtr = inputFactory.createXMLStreamReader(targetStream);
+// DmnDefinition dmnDefinition = new DmnXMLConverter().convertToDmnModel(xtr);
+//
+// DmnRepositoryService dmnRepositoryService = dmnEngine.getDmnRepositoryService();
+// org.flowable.dmn.api.DmnDeployment dmnDeployment = dmnRepositoryService.createDeployment()
+// .name("decision_ONDEMAND").tenantId("abcd").addDmnModel("ondemand_decisions.dmn", dmnDefinition)
+// .deploy();
+//
+//// DmnDecisionTable dmnt = dmnRepositoryService.getDecisionTable( "decision_ONDEMAND" );
+//// assertNotNull(dmnt);
+//
+// ExecuteDecisionBuilder ex = ruleService.createExecuteDecisionBuilder().decisionKey("decision_ONDEMAND")
+// .tenantId("abcd");
+//
+// Map result = ex.variable("cameras", 3).executeWithSingleResult();
+
+
+ // this loads genericdecisions.dmn.. commented for now. Perhasp useful in future!
+ //ExecuteDecisionBuilder ex = ruleService.createExecuteDecisionBuilder().decisionKey("decisionKJ");
+
+ //Map result = ex.variables(variables).executeWithSingleResult();
+
+// if ( result!= null ) {
+// result.putAll( variables );
+// return result;
+// }
+
+// } catch (FileNotFoundException e) {
+// e.printStackTrace();
+// } catch (XMLStreamException e) {
+// e.printStackTrace();
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ return variables;
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/EvaluateCreatedServices.java b/src/main/java/org/etsi/osl/osom/management/EvaluateCreatedServices.java
new file mode 100644
index 0000000000000000000000000000000000000000..341babfddd11c8bbc281bbf6bbd8f6d2d13d21e3
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/EvaluateCreatedServices.java
@@ -0,0 +1,39 @@
+package org.etsi.osl.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component(value = "evaluateCreatedServices") //bean name
+public class EvaluateCreatedServices implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(EvaluateCreatedServices.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("EvaluateCreatedServices:" + execution.getVariableNames().toString());
+
+ execution.setVariable(
+ "finishedServiceID",
+ (String) execution.getVariable("contextServiceId") );
+
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ExternalPartnerCheckDeploymentService.java b/src/main/java/org/etsi/osl/osom/management/ExternalPartnerCheckDeploymentService.java
new file mode 100644
index 0000000000000000000000000000000000000000..a7550e93dd387e3d70ae488525ee2545b5ea3938
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ExternalPartnerCheckDeploymentService.java
@@ -0,0 +1,363 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.partnerservices.PartnerOrganizationServicesManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.UserPartRoleType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceSpecificationRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.prm669.model.RelatedParty;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceCreate;
+import org.etsi.osl.tmf.sim638.model.ServiceOrderRef;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+
+@Component(value = "externalPartnerCheckDeploymentService") //bean name
+public class ExternalPartnerCheckDeploymentService implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ExternalPartnerCheckDeploymentService.class.getName());
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info( "ExternalPartnerCheckDeploymentService" );
+ logger.debug( execution.getVariableNames().toString() );
+ String externalServiceOrderId = (String) execution.getVariable("externalServiceOrderId") ;
+ execution.setVariable("serviceDeploymentFinished", false );
+
+ ServiceOrder sorder = serviceOrderManager.retrieveServiceOrder( execution.getVariable("orderid").toString() );
+ Service aLocalWrapperProxyService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+ logger.debug("Check external partner for Service name:" + aLocalWrapperProxyService.getName() );
+ logger.debug("Check external partner for Service state:" + aLocalWrapperProxyService.getState() );
+ logger.debug("Request to External Service Partner for Service: " + aLocalWrapperProxyService.getId() );
+
+ logger.debug("Checking Order Status of Order Request id: " + externalServiceOrderId );
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aLocalWrapperProxyService.getServiceSpecificationRef().getId() );
+ RelatedParty rpOrg = null;
+ if ( spec.getRelatedParty() != null ) {
+ for (RelatedParty rp : spec.getRelatedParty()) {
+ if ( rp.getRole().equals( UserPartRoleType.ORGANIZATION.getValue() )) {
+ rpOrg =rp;
+ break;
+ }
+ }
+ }
+ Organization orgz = serviceOrderManager.getExternalPartnerOrganization( rpOrg.getId() );
+
+ if ( orgz == null) {
+ logger.error("Cannot retrieve partner organization" );
+
+ return;
+ }
+
+ logger.debug("External partner organization:" + orgz.getName() );
+
+ ServiceOrder externalSOrder = partnerOrganizationServicesManager.retrieveServiceOrder( orgz, externalServiceOrderId );
+ ServiceUpdate serviceProxyUpdate = new ServiceUpdate();
+
+
+
+ if (externalSOrder != null ) {
+ logger.info("External partner organization order state:" + externalSOrder.getState() );
+ if ( externalSOrder.getState().equals( ServiceOrderStateType.COMPLETED )){
+ serviceProxyUpdate.setState( ServiceStateType.ACTIVE);
+ } else if ( externalSOrder.getState().equals( ServiceOrderStateType.ACKNOWLEDGED ) ||
+ externalSOrder.getState().equals( ServiceOrderStateType.INPROGRESS )){
+ serviceProxyUpdate.setState( ServiceStateType.RESERVED );
+ } else if ( externalSOrder.getState().equals( ServiceOrderStateType.CANCELLED ) ||
+ externalSOrder.getState().equals( ServiceOrderStateType.FAILED ) ||
+ externalSOrder.getState().equals( ServiceOrderStateType.REJECTED )){
+ serviceProxyUpdate.setState( ServiceStateType.TERMINATED );
+ } else if ( externalSOrder.getState().equals( ServiceOrderStateType.INITIAL ) ||
+ externalSOrder.getState().equals( ServiceOrderStateType.PENDING )){
+ serviceProxyUpdate.setState( ServiceStateType.RESERVED );
+ } else if ( externalSOrder.getState().equals( ServiceOrderStateType.PARTIAL )){
+ serviceProxyUpdate.setState( ServiceStateType.INACTIVE );
+ }
+
+
+ /**
+ * update now service characteristics from the remote Service Inventory
+ */
+
+ for (ServiceOrderItem ext_soi : externalSOrder.getOrderItem()) {
+ for (ServiceRef serviceRef : ext_soi.getService().getSupportingService()) {
+ Service remotePartnerService = partnerOrganizationServicesManager.retrieveServiceFromInventory( orgz, serviceRef.getId() );
+ //we need to create here on our partner, Services in our ServiceInventory that reflect the remote Services in the partnerService Inventory!
+ if (remotePartnerService!=null) {
+
+ boolean foundInInventory = false;
+
+ List serviceids = serviceOrderManager.retrieveServicesOfOrder( sorder.getId() );
+ for (String sid : serviceids) {
+ Service lservice = serviceOrderManager.retrieveService(sid);
+ Characteristic charexternalPartnerServiceId = lservice.getServiceCharacteristicByName("externalPartnerServiceId");
+ if (( charexternalPartnerServiceId!= null ) && ( charexternalPartnerServiceId.getValue()!= null )) {
+ if ( charexternalPartnerServiceId.getValue().getValue().equals( remotePartnerService.getId() ) ) {
+ foundInInventory = true;
+ //we can update also the current service with the one from remote service inventory
+ ServiceUpdate supd = new ServiceUpdate();
+ for (Characteristic c : remotePartnerService.getServiceCharacteristic()) {
+ c.setUuid(null);
+ if ( !c.getName().equals("EXEC_ACTION")) {
+ supd.addServiceCharacteristicItem(c);
+ }
+ }
+ supd.setState( remotePartnerService.getState() );
+ serviceOrderManager.updateService( lservice.getId(), supd , false);
+ }
+
+ }
+ }
+
+ if ( !foundInInventory ) {
+ Service addedPartnerService = addServiceFromPartnerOrg(
+ sorder,
+ externalSOrder,
+ aLocalWrapperProxyService,
+ spec,
+ orgz,
+ remotePartnerService,
+ externalServiceOrderId);
+
+
+ ServiceRef supportingServiceRef = new ServiceRef();
+ supportingServiceRef.setId( addedPartnerService.getId() );
+ supportingServiceRef.setReferredType( addedPartnerService.getName() );
+ supportingServiceRef.setName( addedPartnerService.getName() );
+ serviceProxyUpdate.addSupportingServiceItem(supportingServiceRef);
+
+ if ( remotePartnerService.getServiceCharacteristic() != null ) {
+ for (Characteristic c : remotePartnerService.getServiceCharacteristic()) {
+ c.setUuid( null );
+ c.setName( orgz.getName()
+ + "::"
+ + remotePartnerService.getName()
+ + "::"
+ + c.getName());// we prefix here with the Service Name of external partner.
+ serviceProxyUpdate.addServiceCharacteristicItem( c );
+ }
+ }
+
+ }
+
+
+ } else {
+ logger.error("ExternalPartnerCheckDeploymentService cannot retrieve remotePartnerService!");
+ }
+
+
+ }
+ }
+
+
+ }
+
+ if ( aLocalWrapperProxyService.getState() != serviceProxyUpdate.getState()) {
+
+ String partnerNotes = "";
+ if ( externalSOrder.getNote()!=null) {
+ for (Note note : externalSOrder.getNote()) {
+ partnerNotes += note.getText() + ".";
+ }
+ partnerNotes = " Notes from external partner order: " + partnerNotes;
+ }
+
+ Note noteItem = new Note();
+ noteItem.setText("Update Service Order State to: " + serviceProxyUpdate.getState() + ". "+ partnerNotes);
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ noteItem.setAuthor( compname );
+ serviceProxyUpdate.addNoteItem( noteItem );
+ Service serviceResult = serviceOrderManager.updateService( aLocalWrapperProxyService.getId(), serviceProxyUpdate, false );
+ if ( serviceResult!=null ) {
+ if ( serviceResult.getState().equals(ServiceStateType.ACTIVE)
+ || serviceResult.getState().equals(ServiceStateType.TERMINATED)) {
+
+ logger.info("Request Deployment Status OK. Service state = " + serviceResult.getState() );
+ execution.setVariable("serviceDeploymentFinished", true);
+ return;
+ }
+ } else {
+ logger.error("Request Deployment Status ERROR from External Parnter with null serviceResult " );
+ }
+ }
+ logger.info("Wait For External Service Partner Status. ");
+
+
+ }
+
+
+ private Service addServiceFromPartnerOrg(ServiceOrder localSOrder,
+ ServiceOrder externalSOrder,
+ Service aLocalWrapperService,
+ ServiceSpecification aLocalServiceSpec,
+ Organization orgz,
+ Service remotePartnerService,
+ String externalServiceOrderId) {
+
+ ServiceCreate serviceToCreate = new ServiceCreate();//the object to update the service
+ serviceToCreate.setName( orgz.getName() + "::"+ remotePartnerService.getName() );
+ serviceToCreate.setState( remotePartnerService.getState() );
+ serviceToCreate.setCategory( remotePartnerService.getCategory() );
+ serviceToCreate.setType( remotePartnerService.getType());
+ serviceToCreate.setServiceDate(remotePartnerService.getServiceDate() );
+ serviceToCreate.setStartDate( remotePartnerService.getStartDate() );
+ serviceToCreate.setEndDate( remotePartnerService.getEndDate() );
+ serviceToCreate.hasStarted( remotePartnerService.isHasStarted() );
+ serviceToCreate.setIsServiceEnabled( remotePartnerService.isIsServiceEnabled() );
+ serviceToCreate.setStartMode( remotePartnerService.getStartMode() );
+
+ Note noteItem = new Note();
+ noteItem.setText("Service Created by ExternalPartnerCheckDeploymentService as a reference to the external Service Inventory of Partner " + orgz.getName() +
+ ". External ServiceID = " + remotePartnerService.getId());
+ noteItem.setAuthor( compname );
+ serviceToCreate.addNoteItem(noteItem);
+
+ ServiceOrderRef serviceOrderref = new ServiceOrderRef();
+ serviceOrderref.setId( localSOrder.getId() );
+ serviceOrderref.setServiceOrderItemId( localSOrder.getId() );
+ serviceToCreate.addServiceOrderItem(serviceOrderref );
+
+ ServiceSpecificationRef serviceSpecificationRef = new ServiceSpecificationRef();
+ serviceSpecificationRef.setId( remotePartnerService.getServiceSpecificationRef().getId() );
+ serviceSpecificationRef.setName( remotePartnerService.getServiceSpecificationRef().getName());
+ serviceToCreate.setServiceSpecificationRef(serviceSpecificationRef );
+
+ if (aLocalServiceSpec.getRelatedParty()!=null) {
+ for (RelatedParty rp : aLocalServiceSpec.getRelatedParty()) {
+ rp.setUuid(null);
+ rp.setExtendedInfo( remotePartnerService.getId() );
+ serviceToCreate.addRelatedPartyItem(rp);
+ }
+ }
+
+ //copy all characteristics
+ for (Characteristic iterableChar : remotePartnerService.getServiceCharacteristic() ) {
+ Characteristic serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( iterableChar.getName() );
+ serviceCharacteristicItem.setValueType( iterableChar.getValueType() );
+
+ Any val = new Any();
+ val.setValue( iterableChar.getValue().getValue() );
+ val.setAlias( iterableChar.getValue().getAlias() );
+
+ serviceCharacteristicItem.setValue( val );
+ serviceToCreate.addServiceCharacteristicItem( serviceCharacteristicItem );
+ }
+
+ //add as extra characteristics:
+ Characteristic serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "externalServiceOrderId" );
+ String vals = externalSOrder.getId() + "";
+ Any any = new Any( vals );
+ serviceCharacteristicItem.setValue( any );
+ serviceToCreate.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "externalPartnerServiceId" );
+ vals = remotePartnerService.getId() + "";
+ any = new Any( vals );
+ serviceCharacteristicItem.setValue( any );
+ serviceToCreate.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+
+ Service createdService = serviceOrderManager.createService( serviceToCreate, localSOrder, aLocalServiceSpec);
+
+ //we need to add also this service as supporting ServiceOrderItem to the LocalServiceOrder
+
+ ServiceOrderItem orderItemItem = new ServiceOrderItem();
+
+ for (ServiceOrderItem soi : localSOrder.getOrderItem()) {
+ if (soi.getService().getServiceSpecification().getId().equals( aLocalServiceSpec.getUuid())) {
+ ServiceRef supportingServiceRef = new ServiceRef();
+ supportingServiceRef.setId( createdService.getId() );
+ supportingServiceRef.setReferredType( createdService.getName() );
+ supportingServiceRef.setName( createdService.getName() );
+ soi.getService().addSupportingServiceItem(supportingServiceRef );
+ orderItemItem = soi;
+ break;
+
+ } else {
+
+
+
+ if ( soi.getService().getSupportingService() != null ) {
+ for (ServiceRef soiServiceRef : soi.getService().getSupportingService() ) {
+ if ( soiServiceRef.getId().equals( aLocalWrapperService.getUuid())) {
+ ServiceRef supportingServiceRef = new ServiceRef();
+ supportingServiceRef.setId( createdService.getId() );
+ supportingServiceRef.setReferredType( createdService.getName() );
+ supportingServiceRef.setName( createdService.getName() );
+ soi.getService().addSupportingServiceItem(supportingServiceRef );
+ orderItemItem = soi;
+ break;
+ }
+
+ }
+
+ }
+ }
+
+
+ }
+
+
+
+ ServiceOrderUpdate serviceOrderUpd = new ServiceOrderUpdate();
+ serviceOrderUpd.addOrderItemItem(orderItemItem);
+ serviceOrderManager.updateServiceOrderOrder( localSOrder.getId(), serviceOrderUpd );
+
+ return createdService;
+ }
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ExternalPartnerSubmitOrderService.java b/src/main/java/org/etsi/osl/osom/management/ExternalPartnerSubmitOrderService.java
new file mode 100644
index 0000000000000000000000000000000000000000..7b6ee4bf850c5216c41f7edcda01fd6631d5b5ee
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ExternalPartnerSubmitOrderService.java
@@ -0,0 +1,185 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.partnerservices.PartnerOrganizationServicesManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.UserPartRoleType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ServiceSpecificationRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.prm669.model.RelatedParty;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderCreate;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceRestriction;
+
+@Component(value = "externalPartnerSubmitOrderService") //bean name
+public class ExternalPartnerSubmitOrderService implements JavaDelegate {
+
+
+ private static final transient Log logger = LogFactory.getLog( ExternalPartnerSubmitOrderService.class.getName());
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+ @Value("${THIS_PARTNER_NAME}")
+ private String THIS_PARTNER_NAME = "";
+
+ @Override
+ public void execute(DelegateExecution execution) {
+
+ logger.info( "ExternalPartnerSubmitOrderService" );
+ logger.info( "VariableNames:" + execution.getVariableNames().toString() );
+ logger.info("orderid:" + execution.getVariable("orderid").toString() );
+ logger.info("contextServiceId:" + execution.getVariable("contextServiceId").toString() );
+
+
+ ServiceUpdate su = new ServiceUpdate();//the object to update the service
+ if (execution.getVariable("contextServiceId") instanceof String) {
+
+ ServiceOrder sorder = serviceOrderManager.retrieveServiceOrder( execution.getVariable("orderid").toString() );
+ Service aService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+ logger.info("Service name:" + aService.getName() );
+ logger.info("Service state:" + aService.getState() );
+ logger.info("Request to External Service Partner for Service: " + aService.getId() );
+
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );
+
+ if ( spec!=null ) {
+ logger.info("Service spec:" + spec.getName() );
+ RelatedParty rpOrg = null;
+ if ( spec.getRelatedParty() != null ) {
+ for (RelatedParty rp : spec.getRelatedParty()) {
+ if ( rp.getRole().equals( UserPartRoleType.ORGANIZATION.getValue() )) {
+ rpOrg =rp;
+ break;
+ }
+ }
+ }
+
+ String remoteServiceSpecID = rpOrg.getExtendedInfo();
+ Organization orgz = serviceOrderManager.getExternalPartnerOrganization( rpOrg.getId() );
+
+ if ( orgz!=null ) {
+ logger.info("External partner organization:" + orgz.getName() + ". Preparing Service Order." );
+
+ ServiceOrderCreate servOrder = new ServiceOrderCreate();
+ servOrder.setCategory("Automated order");
+ servOrder.setDescription("Automatically created by partner " + THIS_PARTNER_NAME);
+ servOrder.setRequestedStartDate( sorder.getStartDate() );
+ servOrder.setRequestedCompletionDate( sorder.getExpectedCompletionDate() );
+
+ Note noteItemOrder = new Note();
+ noteItemOrder.text("Automatically created by partner " + THIS_PARTNER_NAME);
+ noteItemOrder.setAuthor(THIS_PARTNER_NAME);
+ servOrder.addNoteItem( noteItemOrder );
+
+ ServiceOrderItem soi = new ServiceOrderItem();
+ servOrder.getOrderItem().add(soi);
+ soi.setState(ServiceOrderStateType.ACKNOWLEDGED);
+
+ ServiceRestriction serviceRestriction = new ServiceRestriction();
+ ServiceSpecificationRef aServiceSpecificationRef = new ServiceSpecificationRef();
+ aServiceSpecificationRef.setId( remoteServiceSpecID );
+ aServiceSpecificationRef.setName( spec.getName() );
+ aServiceSpecificationRef.setVersion(spec.getVersion());
+
+ serviceRestriction.setServiceSpecification(aServiceSpecificationRef);
+
+ for (Characteristic servChar : aService.getServiceCharacteristic()) {
+ servChar.setUuid(null);
+ serviceRestriction.addServiceCharacteristicItem(servChar);
+ }
+
+ soi.setService(serviceRestriction);
+
+
+ ServiceOrder externalSOrder = partnerOrganizationServicesManager.makeExternalServiceOrder( servOrder, orgz, remoteServiceSpecID );
+
+ if ( externalSOrder != null ) {
+ execution.setVariable("externalServiceOrderId", externalSOrder.getId());
+
+ su.setState(ServiceStateType.FEASIBILITYCHECKED );
+ Note noteItem = new Note();
+ noteItem.setText( "Request to partner " + orgz.getName() + " for spec:" + spec.getName() + " done! ServiceOrder id: " + externalSOrder.getId());
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ noteItem.setAuthor( compname );
+ su.addNoteItem( noteItem );
+ Characteristic serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "externalServiceOrderId" );
+
+ String vals = externalSOrder.getId() + "";
+ Any any = new Any( vals );
+ serviceCharacteristicItem.setValue( any );
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ Service supd = serviceOrderManager.updateService( aService.getId(), su, false);
+ logger.info("Request to partner " + orgz.getName() + " for spec:" + spec.getName() + " done! Service: " + supd.getId() );
+ return;
+ }
+ }
+
+
+ } else {
+ logger.error( "Cannot retrieve ServiceSpecification for service :" + (String) execution.getVariable("serviceId") );
+ }
+ } else {
+ logger.error( "Cannot retrieve variable serviceId" );
+ }
+
+ //if we get here somethign is wrong so we need to terminate the service.
+ Note noteItem = new Note();
+ noteItem.setText("Order Request Service to External Partner FAILED");
+ noteItem.setAuthor( compname );
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ su.addNoteItem( noteItem );
+ su.setState(ServiceStateType.TERMINATED );
+ serviceOrderManager.updateService( execution.getVariable("serviceId").toString(), su, false);
+
+ }
+
+
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/FetchAcknowledgedOrders.java b/src/main/java/org/etsi/osl/osom/management/FetchAcknowledgedOrders.java
new file mode 100644
index 0000000000000000000000000000000000000000..32534760f4562a4f1ee712d2583f104d0552be89
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/FetchAcknowledgedOrders.java
@@ -0,0 +1,101 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.TaskService;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.flowable.task.api.Task;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+
+@Component(value = "fetchAcknowledgedOrders") // bean name
+public class FetchAcknowledgedOrders implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(FetchAcknowledgedOrders.class.getName());
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private TaskService taskService;
+
+
+ public void execute(DelegateExecution execution) {
+ logger.info("======================" + execution.getProcessDefinitionId() + "======================================");
+ logger.info("FetchAcknowledgedOrders by Service Order Repository");
+
+ List ordersToBeProcessed = null;
+ if (execution.getVariable("ordersToBeProcessed") instanceof ArrayList) {
+ ordersToBeProcessed = (ArrayList) execution.getVariable("ordersToBeProcessed");
+ for (String orderid : ordersToBeProcessed) {
+ logger.info("ordersFromPrevious = " + orderid);
+ }
+ } else {
+ ordersToBeProcessed = new ArrayList<>();
+ }
+
+ List orderlist = serviceOrderManager.retrieveOrdersByState( ServiceOrderStateType.ACKNOWLEDGED );
+
+ if ( orderlist != null ) {
+ for (String orderid : orderlist) {
+ if ( !ordersToBeProcessed.contains( orderid ) ) {
+
+
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder( orderid );
+ if ( sor.getStartDate() != null ) {
+ Instant instant = Instant.now() ; // Capture the current moment as seen in UTC.
+ boolean canStart = sor.getStartDate().toInstant().isBefore( instant ) ;
+
+ if ( canStart ) {
+ logger.info("Service order is scheduled to start now, orderid= " + orderid );
+ ordersToBeProcessed.add( orderid );
+ } else {
+ logger.info("Service order is scheduled to start later, orderid= " + orderid );
+ }
+ }
+
+ }
+ }
+ }
+
+ execution.setVariable("ordersToBeProcessed", ordersToBeProcessed);
+
+
+ List tasks = taskService.createTaskQuery()
+ .taskDefinitionKey("stManualCompleteService")
+ .list();
+
+ for (Task t : tasks) {
+ logger.info("PENDING humanComplete t.id=" + t.getId() + "" + "orderid=" + taskService.getVariables(t.getId()).get("orderid") );
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/FetchInProgressOrders.java b/src/main/java/org/etsi/osl/osom/management/FetchInProgressOrders.java
new file mode 100644
index 0000000000000000000000000000000000000000..0f6a3f5b6b2bf59cf5179c191708d300db59edda
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/FetchInProgressOrders.java
@@ -0,0 +1,63 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.TaskService;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+
+@Component(value = "fetchInProgressOrders") // bean name
+public class FetchInProgressOrders implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(FetchInProgressOrders.class.getName());
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private TaskService taskService;
+
+
+ public void execute(DelegateExecution execution) {
+ logger.info("======================Fetch InProgressOrders from Service Order Repository, procid:" + execution.getProcessDefinitionId() + "======================================");
+
+ List orderlist = serviceOrderManager.retrieveOrdersByState( ServiceOrderStateType.INPROGRESS );
+ ArrayList ordersToBeProcessed = new ArrayList<>();
+ if ( orderlist != null ) {
+ for (String orderid : orderlist) {
+ ordersToBeProcessed.add( orderid );
+ }
+ }
+
+ execution.setVariable("ordersToBeQueried", ordersToBeProcessed);
+
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/FindOrderItems.java b/src/main/java/org/etsi/osl/osom/management/FindOrderItems.java
new file mode 100644
index 0000000000000000000000000000000000000000..a80bd82b11e0a24ea1b19702f760f38708b5e281
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/FindOrderItems.java
@@ -0,0 +1,44 @@
+package org.etsi.osl.osom.management;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@Component(value = "findOrderItems") // bean name
+public class FindOrderItems implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(FindOrderItems.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("FindOrderItems: " + execution.getVariables().toString());
+ //orderItemsToBeProcessed
+ //orderItemId
+
+ if (execution.getVariable("orderid") instanceof String) {
+ logger.debug("Will find items of order with id = " + execution.getVariable("orderid"));
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderid"));
+
+ List orderItemsToBeProcessed = new ArrayList<>();
+
+ for (ServiceOrderItem soi : sor.getOrderItem()) {
+ orderItemsToBeProcessed.add( soi.getUuid());
+ }
+
+ execution.setVariable("orderItemsToBeProcessed", orderItemsToBeProcessed);
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/InitializeProcessOrders.java b/src/main/java/org/etsi/osl/osom/management/InitializeProcessOrders.java
new file mode 100644
index 0000000000000000000000000000000000000000..3b2a331fd4724358cea29e6a1146c07fd30f2c66
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/InitializeProcessOrders.java
@@ -0,0 +1,76 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+
+@Component(value = "initializeProcessOrders") // bean name
+public class InitializeProcessOrders implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(InitializeProcessOrders.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("Check if there are new Service Orders for Orchestration: " + execution.getVariables().toString());
+
+ if (execution.getVariable("orderid") instanceof String) {
+ logger.info("Task has available orderid = " + execution.getVariable("orderid"));
+ execution.setVariable("orderid", execution.getVariable("orderid"));// get the first one
+
+ }
+
+ if (execution.getVariable("ordersToBeProcessed") instanceof ArrayList) {
+
+ List ordersToBeProcessed = (ArrayList) execution.getVariable("ordersToBeProcessed");
+ for (String oId : ordersToBeProcessed) {
+
+
+ logger.debug("Will send CAMEL Message that Order is IN-PROGRESS orderid= " + oId );
+
+ ServiceOrderUpdate serviceOrderUpd = new ServiceOrderUpdate();
+ serviceOrderUpd.setState(ServiceOrderStateType.INPROGRESS);
+ serviceOrderManager.updateServiceOrderOrder( oId, serviceOrderUpd );
+
+
+
+ }
+
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/InitializeServiceTestOrchestration.java b/src/main/java/org/etsi/osl/osom/management/InitializeServiceTestOrchestration.java
new file mode 100644
index 0000000000000000000000000000000000000000..3c6a61b07cc192f0ed8f3a3d266087e141dbb21b
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/InitializeServiceTestOrchestration.java
@@ -0,0 +1,41 @@
+package org.etsi.osl.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component(value = "initializeServiceTestOrchestration") //bean name
+public class InitializeServiceTestOrchestration implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( CheckServiceTestDeployment.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Override
+ public void execute(DelegateExecution execution) {
+
+
+ logger.info( "initializeServiceTestOrchestration" );
+ logger.info( "VariableNames:" + execution.getVariableNames().toString() );
+ logger.info("orderid:" + execution.getVariable("orderid").toString() );
+ logger.info("contextServiceId:" + execution.getVariable("contextServiceId").toString() );
+
+
+ if (execution.getVariableLocal("contextServiceId") instanceof String) {
+
+
+
+ } else {
+ logger.error( "Cannot retrieve variable contextServiceId" );
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/LocalSOCheckDeployment.java b/src/main/java/org/etsi/osl/osom/management/LocalSOCheckDeployment.java
new file mode 100644
index 0000000000000000000000000000000000000000..29c6d4df304226a5b76842a10c5bb9cf5ffeb8b3
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/LocalSOCheckDeployment.java
@@ -0,0 +1,148 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.partnerservices.PartnerOrganizationServicesManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+
+
+@Component(value = "localSoCheckDeployment") //bean name
+public class LocalSOCheckDeployment implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( LocalSOCheckDeployment.class.getName());
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info( "LocalSOCheckDeployment" );
+ logger.debug( execution.getVariableNames().toString() );
+
+ execution.setVariable("lsoServiceDeploymentFinished", false );
+
+ ServiceOrder sorder = serviceOrderManager.retrieveServiceOrder( execution.getVariable("orderid").toString() );
+ Service aService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+ logger.debug("Check LocalSOCheckDeploymentfor Service name:" + aService.getName() );
+ logger.debug("Check LocalSOCheckDeployment Service state:" + aService.getState() );
+ logger.debug("Request for Service id: " + aService.getId() );
+
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );
+
+
+ //decide if the service will be active only if it's supported services are also active
+
+ boolean allacctive=true;
+ boolean existsTerminated=false;
+ for (ServiceRef sref : aService.getSupportingService() ) {
+ Service supportedService = serviceOrderManager.retrieveService( sref.getId() );
+ if ( ! supportedService.getState().equals( ServiceStateType.ACTIVE ) ) {
+ allacctive = false;
+ }
+
+ if ( supportedService.getState().equals( ServiceStateType.TERMINATED ) || supportedService.getState().equals( ServiceStateType.INACTIVE ) ) {
+ existsTerminated = true;
+ }
+
+ }
+
+ ServiceUpdate supd = new ServiceUpdate();
+
+ if ( allacctive ) {
+ supd.setState( ServiceStateType.ACTIVE);
+ } else if ( existsTerminated ) {
+ supd.setState( ServiceStateType.TERMINATED);
+ } else {
+ supd.setState( ServiceStateType.RESERVED);
+ }
+
+
+ if (spec.getName().contains("DUMMYSERVICE") ) {
+ logger.info("DUMMYSERVICE status" );
+ ServiceSpecCharacteristic charc = spec.findSpecCharacteristicByName( "FINALSTATUS" );
+ if ( (charc!=null ) && ( charc.getServiceSpecCharacteristicValue() !=null ) ) {
+ try {
+ String val = charc.getServiceSpecCharacteristicValue().stream().findFirst().get().getValue().getValue();
+ if (val.equals("TERMINATED") ) {
+ supd.setState( ServiceStateType.TERMINATED );
+ } else if (val.equals("INACTIVE") ) {
+ supd.setState( ServiceStateType.INACTIVE );
+ } else if (val.equals("RESERVED") ) {
+ supd.setState( ServiceStateType.RESERVED );
+ } else if (val.equals("ACTIVE") ) {
+ supd.setState( ServiceStateType.ACTIVE );
+ }
+ }catch (Exception e) {
+
+ }
+ }
+ }
+
+ if ( aService.getState() != supd.getState()) {
+ Note noteItem = new Note();
+ noteItem.setText("Update Service State to: " + supd.getState() + ". ");
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ noteItem.setAuthor( compname );
+ supd.addNoteItem( noteItem );
+ Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, false );
+ if ( serviceResult.getState().equals(ServiceStateType.ACTIVE)
+ || serviceResult.getState().equals(ServiceStateType.TERMINATED)) {
+
+ logger.info("Deployment Status OK. Service state = " + serviceResult.getState() );
+ execution.setVariable("lsoServiceDeploymentFinished", true);
+ return;
+ }
+ }
+ logger.info("Wait For Local SO Service Status. ");
+
+ if ( aService.getState().equals(ServiceStateType.ACTIVE)
+ || aService.getState().equals(ServiceStateType.TERMINATED)) {
+
+ logger.info("Deployment Status OK. Service state EQUAL = " + aService.getState() );
+ execution.setVariable("lsoServiceDeploymentFinished", true);
+ return;
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/LocalSOInitialize.java b/src/main/java/org/etsi/osl/osom/management/LocalSOInitialize.java
new file mode 100644
index 0000000000000000000000000000000000000000..b8276f77742f9803dc49eb07a1de2dd965b00f1c
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/LocalSOInitialize.java
@@ -0,0 +1,103 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+
+@Component(value = "localSoInitialize") //bean name
+public class LocalSOInitialize implements JavaDelegate {
+
+
+ private static final transient Log logger = LogFactory.getLog( LocalSOInitialize.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Override
+ public void execute(DelegateExecution execution) {
+
+ logger.info( "LocalSOInitialize" );
+ logger.info( "VariableNames:" + execution.getVariableNames().toString() );
+ logger.info("orderid:" + execution.getVariable("orderid").toString() );
+ logger.info("contextServiceId:" + execution.getVariable("contextServiceId").toString() );
+
+
+ ServiceUpdate su = new ServiceUpdate();//the object to update the service
+ if (execution.getVariableLocal("contextServiceId") instanceof String) {
+
+ ServiceOrder sorder = serviceOrderManager.retrieveServiceOrder( execution.getVariable("orderid").toString() );
+ Service aService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+ logger.info("Service name:" + aService.getName() );
+ logger.info("Service state:" + aService.getState() );
+ logger.info("Request to External Service Partner for Service: " + aService.getId() );
+
+// ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );
+//
+// if ( spec!=null ) {
+// logger.info("Service spec:" + spec.getName() );
+//
+//
+// su.setState(ServiceStateType.FEASIBILITYCHECKED );
+// Note noteItem = new Note();
+// noteItem.setText( "Local Service Orchestration initialized for spec:" + spec.getName() + " done!");
+// noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+// noteItem.setAuthor( compname );
+// su.addNoteItem( noteItem );
+//
+//
+// Service supd = serviceOrderManager.updateService( aService.getId(), su, false);
+// logger.info("Service updated: " + supd.getId() );
+// return;
+//
+//
+//
+// } else {
+// logger.error( "Cannot retrieve ServiceSpecification for service :" + (String) execution.getVariableLocal("contextServiceId") );
+// }
+ } else {
+ logger.error( "Cannot retrieve variable contextServiceId" );
+ }
+
+// //if we get here somethign is wrong so we need to terminate the service.
+// Note noteItem = new Note();
+// noteItem.setText("Order Request Service for Local Service Orchestration FAILED");
+// noteItem.setAuthor( compname );
+// noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+// su.addNoteItem( noteItem );
+// su.setState(ServiceStateType.TERMINATED );
+// serviceOrderManager.updateService( execution.getVariableLocal("contextServiceId").toString(), su, false);
+
+ }
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/NFVOrchestrationCheckDeploymentService.java b/src/main/java/org/etsi/osl/osom/management/NFVOrchestrationCheckDeploymentService.java
new file mode 100644
index 0000000000000000000000000000000000000000..740a8fdc78d74c04a5abe83b6661da9539872153
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/NFVOrchestrationCheckDeploymentService.java
@@ -0,0 +1,179 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.model.DeploymentDescriptorStatus;
+import org.etsi.osl.model.DeploymentDescriptorVxFInstanceInfo;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+
+@Component(value = "nfvOrchestrationCheckDeploymentService") //bean name
+public class NFVOrchestrationCheckDeploymentService implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(NFVOrchestrationCheckDeploymentService.class.getName());
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info( "NFVOrchestrationCheckDeploymentService" );
+ logger.info( execution.getVariableNames().toString() );
+ Long deploymentId = (Long) execution.getVariable("deploymentId") ;
+ if ( deploymentId == null) {
+
+ logger.error( "Variable deploymentId is NULL!" );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE );
+ return;
+ }
+ if ( execution.getVariable("contextServiceId") == null) {
+
+ logger.error( "Variable contextServiceId is NULL!" );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE );
+ return;
+ }
+ Service aService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+
+ if ( aService == null ) {
+ logger.info( "aService is null for contextServiceId = " +(String) execution.getVariable("contextServiceId") );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE );
+ return;
+ }
+ //retrieve Status from NFVO (OSM?) scheduler
+ logger.info("Checking Deployment Status of deployment Request id: " + deploymentId );
+
+ DeploymentDescriptor dd =serviceOrderManager.retrieveNFVODeploymentRequestById( deploymentId );
+
+ if ( dd == null) {
+
+ logger.error( "DeploymentDescriptor dd is NULL!" );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE );
+ return;
+ }
+
+ execution.setVariable("serviceDeploymentFinished", Boolean.FALSE );
+
+ logger.info("Operational Status of deployment Request id: " + dd.getOperationalStatus() );
+ logger.info("Status of deployment Request id: " + dd.getStatus() );
+ ServiceUpdate supd = new ServiceUpdate();
+ boolean aVNFINDEXREFadded = false;
+
+ boolean propagateToSO = false;
+
+ if ( aService.getServiceCharacteristic() != null ) {
+ for (Characteristic c : aService.getServiceCharacteristic()) {
+ if ( c.getName().equals("Status")) {
+ c.setValue( new Any( dd.getStatus() + "" ));
+ } else if ( c.getName().equals("OperationalStatus")) {
+ c.setValue( new Any( dd.getOperationalStatus() + "" ));
+ } else if ( c.getName().equals("ConstituentVnfrIps")) {
+ c.setValue( new Any( dd.getConstituentVnfrIps() + "" ));
+ } else if ( c.getName().equals("ConfigStatus")) {
+ c.setValue( new Any( dd.getConfigStatus() + "" ));
+ } else if ( c.getName().equals("InstanceId")) {
+ c.setValue( new Any( dd.getInstanceId() + "" ));
+ } else if ( c.getName().equals("NSR")) {
+ c.setValue( new Any( dd.getNsr() + "" ));
+ propagateToSO = true;
+ } else if ( c.getName().equals("NSLCM")) {
+ c.setValue( new Any( dd.getNs_nslcm_details() + "" ));
+ propagateToSO = true;
+ }
+ if ( dd.getDeploymentDescriptorVxFInstanceInfo() !=null ) {
+ for ( DeploymentDescriptorVxFInstanceInfo vnfinfo : dd.getDeploymentDescriptorVxFInstanceInfo() ) {
+ if ( c.getName().equals( "VNFINDEXREF_INFO_" + vnfinfo.getMemberVnfIndexRef() )) {
+ c.setValue( new Any( vnfinfo.getVxfInstanceInfo() + "" ));
+ aVNFINDEXREFadded = true;
+ propagateToSO = true;
+ }
+
+ }
+ }
+
+ supd.addServiceCharacteristicItem( c );
+ }
+
+ if (!aVNFINDEXREFadded) {
+ if ( dd.getDeploymentDescriptorVxFInstanceInfo() !=null ) {
+ for (DeploymentDescriptorVxFInstanceInfo vnfinfo : dd.getDeploymentDescriptorVxFInstanceInfo()) {
+ if ( vnfinfo.getMemberVnfIndexRef()!=null ){
+ Characteristic serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "VNFINDEXREF_INFO_" + vnfinfo.getMemberVnfIndexRef() );
+ serviceCharacteristicItem.setValue( new Any( vnfinfo.getVxfInstanceInfo() ));
+ supd.addServiceCharacteristicItem(serviceCharacteristicItem);
+ }
+ }
+ }
+ }
+
+
+ } else {
+ logger.error("Service has no characteristics!" );
+
+ }
+
+ if ( dd.getStatus().equals( DeploymentDescriptorStatus.RUNNING) ) {
+ supd.setState( ServiceStateType.ACTIVE);
+ } else if ( dd.getStatus().equals( DeploymentDescriptorStatus.FAILED) ) {
+ supd.setState( ServiceStateType.INACTIVE );
+ } else if ( dd.getStatus().equals( DeploymentDescriptorStatus.REJECTED)
+ || dd.getStatus().equals( DeploymentDescriptorStatus.FAILED_OSM_REMOVED)
+ || dd.getStatus().equals( DeploymentDescriptorStatus.COMPLETED)
+ || dd.getStatus().equals( DeploymentDescriptorStatus.TERMINATED)
+ || dd.getStatus().equals( DeploymentDescriptorStatus.TERMINATION_FAILED) ) {
+ supd.setState( ServiceStateType.TERMINATED );
+ }
+
+ Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, propagateToSO );
+
+ if ( serviceResult!= null ) {
+ if ( serviceResult.getState().equals(ServiceStateType.ACTIVE)
+ ||serviceResult.getState().equals(ServiceStateType.INACTIVE)
+ || serviceResult.getState().equals(ServiceStateType.TERMINATED)) {
+
+ logger.info("Deployment Status OK. Service state = " + serviceResult.getState() );
+ execution.setVariable("serviceDeploymentFinished", Boolean.TRUE);
+ return;
+ }
+ }
+ logger.info("Wait For Deployment Status. ");
+
+
+
+
+
+ }
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/NFVOrchestrationService.java b/src/main/java/org/etsi/osl/osom/management/NFVOrchestrationService.java
new file mode 100644
index 0000000000000000000000000000000000000000..d4ef027189900c820b4126db9535ca97ac9bd066
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/NFVOrchestrationService.java
@@ -0,0 +1,372 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.Date;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.model.DeploymentDescriptorStatus;
+import org.etsi.osl.model.ExperimentMetadata;
+import org.etsi.osl.model.ExperimentOnBoardDescriptor;
+import org.etsi.osl.model.NetworkServiceDescriptor;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+
+
+@Component(value = "nfvOrchestrationService") //bean name
+public class NFVOrchestrationService implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(NFVOrchestrationService.class.getName());
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private DependencyRulesSolver aDependencyRulesSolver;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info( "NFVOrchestrationService" );
+ logger.info( "VariableNames:" + execution.getVariableNames().toString() );
+ logger.info("orderid:" + execution.getVariable("orderid").toString() );
+ logger.info("contextServiceId:" + execution.getVariable("contextServiceId").toString() );
+
+ ServiceUpdate su = new ServiceUpdate();//the object to update the service
+ Note noteItem = new Note();
+ noteItem.setText("");
+
+ if (execution.getVariable("contextServiceId") instanceof String) {
+
+
+ ServiceOrder sorder = serviceOrderManager.retrieveServiceOrder( execution.getVariable("orderid").toString() );
+ Service aService = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+ logger.info("Service name:" + aService.getName() );
+ logger.info("Service state:" + aService.getState() );
+ logger.info("Request to NFVO for Service: " + aService.getId() );
+
+ //we need to retrieve here the Service Spec of this service that we send to the NFVO
+
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );
+
+ if ( spec!=null ) {
+
+ ServiceSpecCharacteristic c = spec.getServiceSpecCharacteristicByName( "NSDID" );
+
+ String NSDID = c.getDefaultValue();
+
+
+
+ if ( NSDID != null) {
+ /**
+ * it is registered in our NFV catalog. Let's request an instantiation of it
+ */
+
+
+ ServiceSpecCharacteristic cOSM_NSDCATALOGID = spec.getServiceSpecCharacteristicByName( "OSM_NSDCATALOGID" );
+ ServiceSpecCharacteristic cOnBoardDescriptorID = spec.getServiceSpecCharacteristicByName( "OnBoardDescriptorID" );
+ ServiceSpecCharacteristic cOnBoardDescriptorUUID = spec.getServiceSpecCharacteristicByName( "OnBoardDescriptorUUID" );
+ ServiceSpecCharacteristic cMANOproviderName = spec.getServiceSpecCharacteristicByName( "MANOproviderName" );
+
+
+ String OSM_NSDCATALOGID = "";
+ String OnBoardDescriptorID = "";
+ String OnBoardDescriptorUUID = "";
+ String MANOproviderName = "";
+
+ try {
+ if ( cOSM_NSDCATALOGID!=null && OnBoardDescriptorID!=null && OnBoardDescriptorUUID!=null && MANOproviderName!=null ) {
+ OSM_NSDCATALOGID = cOSM_NSDCATALOGID.getDefaultValue();
+ OnBoardDescriptorID = cOnBoardDescriptorID.getDefaultValue();
+ OnBoardDescriptorUUID = cOnBoardDescriptorUUID.getDefaultValue();
+ MANOproviderName = cMANOproviderName.getDefaultValue();
+ } else {
+ throw new Exception( "Found NULL mandatory values. Instnatiation cannot proceed" );
+ }
+
+ } catch (Exception e) {
+ logger.error("Cannot create DeploymentDescriptor request");
+ e.printStackTrace();
+ }
+
+
+ try {
+ NetworkServiceDescriptor refnsd = serviceOrderManager.retrieveNSD( NSDID );
+
+
+ if ( refnsd == null ) {
+ logger.error("NetworkServiceDescriptor cannot be retrieved, NSDID: " + NSDID );
+ execution.setVariable("deploymentId", null);
+ noteItem.setText("Request to NFVO FAILED. NetworkServiceDescriptor cannot be retrieved, NSDID: " + NSDID);
+ throw new Exception( "NetworkServiceDescriptor cannot be retrieved, NSDID: " + NSDID );
+ }
+
+ Map configParams = aDependencyRulesSolver.get( sorder, spec );
+
+ DeploymentDescriptor dd = createNewDeploymentRequest( aService, refnsd,
+ sorder.getStartDate(),
+ sorder.getExpectedCompletionDate(),
+ sorder.getId(),
+ configParams, OSM_NSDCATALOGID, OnBoardDescriptorID, OnBoardDescriptorUUID);
+
+ su.setState(ServiceStateType.RESERVED );
+ Note successNoteItem = new Note();
+ successNoteItem.setText(String.format("Request to NFVO %s with Deployment Request id:%s",
+ MANOproviderName,
+ dd.getId()));
+ successNoteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ successNoteItem.setAuthor( compname );
+ su.addNoteItem( successNoteItem );
+
+ Characteristic serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "DeploymentRequestID" );
+ serviceCharacteristicItem.setValue( new Any( dd.getId() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "Status" );
+ serviceCharacteristicItem.setValue( new Any( dd.getStatus() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "OperationalStatus" );
+ serviceCharacteristicItem.setValue( new Any( dd.getOperationalStatus() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "ConstituentVnfrIps" );
+ serviceCharacteristicItem.setValue( new Any( dd.getConstituentVnfrIps() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "ConfigStatus" );
+ serviceCharacteristicItem.setValue( new Any( dd.getConfigStatus() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "APPLY_CONFIG" );
+ serviceCharacteristicItem.setValue( new Any( dd.getInstantiationconfig() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "InstanceId" );
+ serviceCharacteristicItem.setValue( new Any( dd.getInstanceId() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "NSR" );
+ serviceCharacteristicItem.setValue( new Any( dd.getNsr() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ serviceCharacteristicItem = new Characteristic();
+ serviceCharacteristicItem.setName( "NSLCM" );
+ serviceCharacteristicItem.setValue( new Any( dd.getNs_nslcm_details() + "" ));
+ su.addServiceCharacteristicItem(serviceCharacteristicItem);
+
+ Service supd = serviceOrderManager.updateService( aService.getId(), su, false);
+ logger.info("Request to NFVO for NSDID:" + NSDID + " done! Service: " + supd.getId() );
+
+ execution.setVariable("deploymentId", dd.getId());
+
+
+ return;
+ } catch (Exception e) {
+ logger.error("Cannot create DeploymentDescriptor request");
+ e.printStackTrace();
+ }
+
+ finally {
+
+ }
+
+ } else {
+
+ logger.error( "Cannot retrieve NSDID from ServiceSpecification for service :" + spec.getId() );
+ }
+
+ } else {
+
+ logger.error( "Cannot retrieve ServiceSpecification for service :" + (String) execution.getVariable("contextServiceId") );
+ }
+ } else {
+ logger.error( "Cannot retrieve variable contextServiceId" );
+ }
+
+ //if we get here somethign is wrong so we need to terminate the service.
+
+ noteItem.setText("Request to NFVO FAILED." + noteItem.getText() );
+ noteItem.setAuthor( compname );
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ su.addNoteItem( noteItem );
+ su.setState(ServiceStateType.TERMINATED );
+ serviceOrderManager.updateService( execution.getVariable("contextServiceId").toString(), su, false);
+
+ }
+
+
+
+ private DeploymentDescriptor createNewDeploymentRequest(Service aService,
+ NetworkServiceDescriptor refnsd, OffsetDateTime startDate, OffsetDateTime endDate, String orderid,
+ Map configParams, String OSM_NSDCATALOGID, String OnBoardDescriptorID, String OnBoardDescriptorUUID) {
+ DeploymentDescriptor ddreq = new DeploymentDescriptor();
+ ExperimentMetadata expReq = refnsd;
+
+
+ ddreq.setName("Service Order " + orderid);
+ ddreq.setDescription("Created automatically by OSOM for Service Order " + orderid);
+ ddreq.setExperiment( expReq );
+ ddreq.setStartReqDate( new Date(startDate.toInstant().toEpochMilli()) );
+ ddreq.setStartDate( new Date(startDate.toInstant().toEpochMilli()) );
+ ddreq.setEndReqDate( new Date(endDate.toInstant().toEpochMilli()) );
+ ddreq.setEndDate( new Date(endDate.toInstant().toEpochMilli()) );
+ ddreq.setStatus( DeploymentDescriptorStatus.SCHEDULED );
+
+ ExperimentOnBoardDescriptor obddescriptor = new ExperimentOnBoardDescriptor();
+ obddescriptor.setId( Long.parseLong(OnBoardDescriptorID) );
+ obddescriptor.setUuid(OnBoardDescriptorUUID);
+ obddescriptor.setDeployId(OSM_NSDCATALOGID);
+ ddreq.setObddescriptor_uuid( obddescriptor );
+
+ String instantiationconfig = "{}";
+ Characteristic configCharacteristic = aService.getServiceCharacteristicByName( "OSM_CONFIG" );
+ if ( (configCharacteristic!=null) &&
+ (configCharacteristic.getValue() != null) &&
+ (configCharacteristic.getValue().getValue() != null)
+ &&
+ (!configCharacteristic.getValue().getValue().equals("") )) {
+ try {
+ instantiationconfig = configCharacteristic.getValue().getValue();
+ }catch (Exception e) {
+ logger.error("cannot extract OSM_CONFIG");
+ e.printStackTrace();
+ }
+ } else {
+ configCharacteristic = null;
+ }
+
+// /**
+// * we will pass all characteristics if there is NO additionalParamsForVnf already added in confi param
+// * { additionalParamsForVnf: [ {member-vnf-index: "1", additionalParams: {touch_filename: your-value, touch_filename2: your-value2} }] }'
+// */
+// if ( ( !instantiationconfig.contains("additionalParamsForVnf") ) &&
+// (ddreq.getExperiment() !=null ) &&
+// (ddreq.getExperiment().getConstituentVxF() !=null )){
+//
+//
+// String serviceParams="";
+// for (Characteristic chars : aService.getServiceCharacteristic() ) {
+// if ( ( chars.getValue()!= null ) && ( !chars.getName().equals("OSM_CONFIG") )) {
+// if (!chars.getName().contains( "Primitive::") ) {
+// serviceParams = serviceParams + "\"" + chars.getName() + "\" : \"" + chars.getValue().getValue() + "\",";
+// }
+// }
+// }
+// serviceParams = serviceParams + " \"_lastParam\": \"_last\"";
+//
+//
+// serviceParams = "\"additionalParams\": {" + serviceParams + "}";
+//
+// StringBuilder additionalParamsForVnf = new StringBuilder();
+//
+// additionalParamsForVnf.append(" \"additionalParamsForVnf\": [ ");
+// for (ConstituentVxF cvxf : ddreq.getExperiment().getConstituentVxF()) {
+// additionalParamsForVnf.append("{ \"member-vnf-index\": \"" + cvxf.getMembervnfIndex() + "\", " + serviceParams + "}") ;
+// additionalParamsForVnf.append(",");
+// }
+//
+// int k = additionalParamsForVnf.lastIndexOf(",");
+// if ( k>=0 ) {
+// additionalParamsForVnf.delete( k, k+1 );
+// }
+// additionalParamsForVnf.append(" ] ");
+//
+// String acomma="";
+// if ( configCharacteristic!=null ) {
+// acomma = ",";
+// }
+// instantiationconfig = instantiationconfig.replaceFirst( Pattern.quote("{") , "{" + additionalParamsForVnf.toString() + acomma );
+// }
+
+ Characteristic sshk= aService.getServiceCharacteristicByName( "SSHKEY" );
+ if ( (sshk!=null) &&
+ ( sshk.getValue()!=null ) &&
+ ( sshk.getValue().getValue() !=null ) ) {
+ try {
+ String sshval = sshk.getValue().getValue();
+ if ( sshval!=null ) {
+ instantiationconfig = instantiationconfig.replaceFirst( Pattern.quote("{") , "{ \"ssh_keys\": [\"" + sshval + "\"],");
+ }
+ }catch (Exception e) {
+ logger.error("cannot extract SSHKEY");
+ e.printStackTrace();
+ }
+ }
+
+
+ instantiationconfig = instantiationconfig.replaceFirst( Pattern.quote("{") , "{\"nsName\": \"" + "Service_Order_" + orderid + "\",");
+
+ /**
+ * for now only if OSM_CONFIG is not empty we will pass all parameters!. WE still Need nsdId and probably vimId
+ */
+ if ( configCharacteristic!=null) {
+ ddreq.setInstantiationconfig(instantiationconfig);
+ logger.debug( "instantiationconfig: " + instantiationconfig );
+ }
+
+
+
+ DeploymentDescriptor dd =serviceOrderManager.nfvoDeploymentRequestByNSDid( ddreq );
+
+ if ( dd == null ) {
+ logger.error("DeploymentDescriptor is NULL");
+
+ }
+ return dd;
+ }
+
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/OrderCompleteService.java b/src/main/java/org/etsi/osl/osom/management/OrderCompleteService.java
new file mode 100644
index 0000000000000000000000000000000000000000..fa592d492b14bebcf75176ba25d7462f71e439e2
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/OrderCompleteService.java
@@ -0,0 +1,225 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ResourceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+import jakarta.validation.Valid;
+
+
+@Component(value = "orderCompleteService") //bean name
+public class OrderCompleteService implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(OrderCompleteService.class.getName());
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ NFVOrchestrationCheckDeploymentService nfvOrchestrationCheckDeploymentService;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("OrderCompleteService:" + execution.getVariableNames().toString() );
+
+ if (execution.getVariable("orderId")!=null) {
+ logger.info("Will check status of services of orderid:" + execution.getVariable("orderId") );
+
+ ServiceOrder sOrder = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderId") );
+
+ if (sOrder == null) {
+ logger.error("Cannot retrieve Service Order details from catalog.");
+ return;
+ }
+
+ for (ServiceOrderItem soi : sOrder.getOrderItem()) {
+ for (ServiceRef sref : soi.getService().getSupportingService()) {
+ Service aService = serviceOrderManager.retrieveService(sref.getId());
+
+ if ((aService != null)
+ && (aService.getServiceCharacteristicByName("externalPartnerServiceId") != null)) {
+ // service belongs to a partner. Here we might query it
+
+ } else if ((aService != null)
+ && (aService.getServiceCharacteristicByName("DeploymentRequestID") != null)) {
+
+ if (nfvOrchestrationCheckDeploymentService != null) {
+ String deploymentRequestID = aService.getServiceCharacteristicByName("DeploymentRequestID")
+ .getValue().getValue();
+
+ if ( deploymentRequestID.length()>0 ) {
+ execution.setVariable("deploymentId", Long.parseLong(deploymentRequestID));
+ execution.setVariable("serviceId", aService.getUuid());
+ execution.setVariable("contextServiceId", aService.getUuid());
+
+ nfvOrchestrationCheckDeploymentService.execute(execution);
+ }
+
+ }
+
+ }
+ }
+
+ }
+
+
+ @Valid
+ ServiceOrderStateType currentState = sOrder.getState();
+
+ boolean allCompletedItemsInOrder= true;
+ boolean allTerminatedItemsInOrder= true;
+ boolean existsInactiveInORder= false;
+ boolean existsTerminatedInORder= false;
+ //boolean updateServiceOrder= false;
+
+ logger.info("ServiceOrder id:" + sOrder.getId());
+ for (ServiceOrderItem soi : sOrder.getOrderItem()) {
+ boolean existsReserved=false;
+ boolean existsInactive=false;
+ boolean existsActive=false;
+ boolean existsTerminated=false;
+ boolean allTerminated= ( soi.getService().getSupportingService() != null && soi.getService().getSupportingService().size()>0)
+ || ( soi.getService().getSupportingResource() != null && soi.getService().getSupportingResource().size()>0 );
+ boolean existsDesigned=false;
+ boolean allActive= ( soi.getService().getSupportingService() != null && soi.getService().getSupportingService().size()>0)
+ || ( soi.getService().getSupportingResource() != null && soi.getService().getSupportingResource().size()>0 );
+
+
+ if ( soi.getService().getSupportingService() != null) {
+ for (ServiceRef sr : soi.getService().getSupportingService()) {
+ Service srv = serviceOrderManager.retrieveService( sr.getId() );
+ existsReserved = existsReserved || srv.getState().equals(ServiceStateType.RESERVED );
+ existsInactive = existsInactive || srv.getState().equals(ServiceStateType.INACTIVE );
+ existsDesigned = existsDesigned || srv.getState().equals(ServiceStateType.DESIGNED );
+ existsActive = existsActive || srv.getState().equals(ServiceStateType.ACTIVE );
+ existsTerminated = existsTerminated || srv.getState().equals(ServiceStateType.TERMINATED );
+ allTerminated = allTerminated && srv.getState().equals(ServiceStateType.TERMINATED );
+ allActive = allActive && srv.getState().equals(ServiceStateType.ACTIVE );
+ }
+ }
+
+
+ if ( soi.getService().getSupportingResource() != null) {
+ for (ResourceRef rr : soi.getService().getSupportingResource()) {
+ Service srv = serviceOrderManager.retrieveService( rr.getId() );
+ existsReserved = existsReserved || srv.getState().equals(ServiceStateType.RESERVED );
+ existsInactive = existsInactive || srv.getState().equals(ServiceStateType.INACTIVE );
+ existsDesigned = existsDesigned || srv.getState().equals(ServiceStateType.DESIGNED );
+ existsActive = existsActive || srv.getState().equals(ServiceStateType.ACTIVE );
+ existsTerminated = existsTerminated || srv.getState().equals(ServiceStateType.TERMINATED );
+ allTerminated = allTerminated && srv.getState().equals(ServiceStateType.TERMINATED );
+ allActive = allActive && srv.getState().equals(ServiceStateType.ACTIVE );
+ }
+ }
+
+ @Valid
+ ServiceStateType sserviceState = soi.getService().getState();
+ if (allActive) {
+ sserviceState = ServiceStateType.ACTIVE;
+ soi.setState( ServiceOrderStateType.COMPLETED );
+ } else if (allTerminated) {
+ sserviceState = ServiceStateType.TERMINATED;
+ soi.setState( ServiceOrderStateType.COMPLETED );
+ existsTerminatedInORder = true;
+ } else if (existsInactive) {
+ sserviceState = ServiceStateType.INACTIVE;
+ soi.setState( ServiceOrderStateType.FAILED );
+ existsInactiveInORder = true;
+ } else if (existsDesigned) {
+ sserviceState = ServiceStateType.DESIGNED;
+ soi.setState( ServiceOrderStateType.INPROGRESS );
+ } else if (existsReserved) {
+ sserviceState = ServiceStateType.RESERVED;
+ soi.setState( ServiceOrderStateType.INPROGRESS );
+ }
+
+
+
+
+// if ( soi.getService().getState() != sserviceState ) {
+// updateServiceOrder = true;
+// }
+ soi.getService().setState(sserviceState);
+
+// allCompletedItemsInOrder = allCompletedItemsInOrder && soi.getService().getState().equals( ServiceStateType.ACTIVE );
+// allTerminatedItemsInOrder = allTerminatedItemsInOrder && soi.getService().getState().equals( ServiceStateType.TERMINATED );
+
+ allCompletedItemsInOrder = allCompletedItemsInOrder && soi.getState().equals( ServiceOrderStateType.COMPLETED );
+ allTerminatedItemsInOrder = allTerminatedItemsInOrder && soi.getState().equals( ServiceOrderStateType.COMPLETED );
+
+ logger.info("ServiceOrderItem state:" + sserviceState.toString() );
+ }
+
+
+ if (allCompletedItemsInOrder || allTerminatedItemsInOrder) {
+ //updateServiceOrder = true;
+ sOrder.setState( ServiceOrderStateType.COMPLETED );
+ } else if ( existsInactiveInORder ) {
+ sOrder.setState( ServiceOrderStateType.FAILED );
+ } else if ( existsTerminatedInORder ) {
+ sOrder.setState( ServiceOrderStateType.FAILED );
+ }
+
+ if ( currentState != sOrder.getState() ) {
+ logger.info("Will update ServiceOrder with state:" + sOrder.getState() );
+ ServiceOrderUpdate serviceOrderUpd = new ServiceOrderUpdate();
+ serviceOrderUpd.setState( sOrder.getState() );
+
+ for (ServiceOrderItem orderItemItem : sOrder.getOrderItem()) {
+ serviceOrderUpd.addOrderItemItem(orderItemItem);
+ }
+
+ Note noteItem = new Note();
+ noteItem.setText( String.format( "Service Order State is: %s " , serviceOrderUpd.getState()) );
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ noteItem.setAuthor( compname );
+ serviceOrderUpd.addNoteItem( noteItem );
+
+ serviceOrderManager.updateServiceOrderOrder( sOrder.getId() , serviceOrderUpd);
+
+ }
+
+ }
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ProcessCreateServiceRules.java b/src/main/java/org/etsi/osl/osom/management/ProcessCreateServiceRules.java
new file mode 100644
index 0000000000000000000000000000000000000000..e21df96f23280348276a440401ac3204576c38b0
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ProcessCreateServiceRules.java
@@ -0,0 +1,175 @@
+package org.etsi.osl.osom.management;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.etsi.osl.osom.lcm.LCMRulesExecutorVariables;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.lcm.model.ELCMRulePhase;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecRelationship;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@Component(value = "processCreateServiceRules")
+public class ProcessCreateServiceRules implements JavaDelegate {
+ private static final transient Log logger = LogFactory.getLog( ProcessCreateServiceRules.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("processCreateServiceRules:" + execution.getVariableNames().toString());
+ Boolean allSupportingServicesCreatedAndActive = Boolean.TRUE;
+ Boolean allSupportingServicesCreated = Boolean.TRUE;
+
+ execution.setVariable("allSupportingServicesCreatedAndActive", allSupportingServicesCreatedAndActive ); //by default
+ execution.setVariable("allSupportingServicesCreated", allSupportingServicesCreated ); //by default
+
+
+ Service contextService = null;
+ String contextServiceId = (String) execution.getVariable("contextServiceId");
+ if ( contextServiceId != null ) {
+ contextService = serviceOrderManager.retrieveService(contextServiceId);
+ }else {
+ return;
+ }
+
+ ServiceSpecification spec = null;
+ String contextServiceSpecId = (String) execution.getVariable("contextServiceSpecId");
+ if ( contextServiceSpecId != null ) {
+ spec = serviceOrderManager.retrieveServiceSpec(contextServiceSpecId);
+ } else {
+ return;
+ }
+
+
+ /*
+ * first find all referenced ServiceSpecs of a ServiceSpec to be created
+ */
+ boolean foundCreatedButNOTACTIVEServices = false;
+ Map tobeCreated = new HashMap<>();
+ for (ServiceSpecRelationship specRels : spec.getServiceSpecRelationship()) {
+ logger.debug("\tService specRelsId:" + specRels.getId());
+ tobeCreated.put(specRels.getId(), true);
+ }
+
+
+ for ( ServiceRef serviceRef: contextService.getSupportingService() ) {
+
+ Service theServiceReferenced = serviceOrderManager.retrieveService( serviceRef.getId() );
+
+ if ( tobeCreated.get(theServiceReferenced.getServiceSpecificationRef().getId() ) != null ) {
+ tobeCreated.put( theServiceReferenced.getServiceSpecificationRef().getId(), false);
+ }
+
+
+ if ( theServiceReferenced != null ) {
+ if ( theServiceReferenced.getState().equals( ServiceStateType.RESERVED) ) {
+ foundCreatedButNOTACTIVEServices = true;
+ }
+ }
+
+ }
+
+
+ /**
+ * decisions for CREATE dependencies
+ *
+ */
+
+ //execute any LCM rules "SUPERVISION" phase for the SPEC;
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderid"));
+ String orderItemIdToProcess = (String) execution.getVariable("orderItemId");
+ ServiceOrderItem soi = null;
+
+ for (ServiceOrderItem i : sor.getOrderItem()) {
+ if (i.getUuid().equals( orderItemIdToProcess )){
+ soi = i;
+ break;
+ }
+ }
+
+ ServiceUpdate supd = new ServiceUpdate();
+ LCMRulesExecutorVariables vars = new LCMRulesExecutorVariables(spec, sor, soi, null, supd , contextService, serviceOrderManager);
+
+ logger.debug("===============BEFORE lcmRulesController.exec Phase CREATION for spec:" + spec.getName() + " =============================");
+ vars = lcmRulesController.execPhase( ELCMRulePhase.CREATION, vars );
+
+ //logger.debug("vars= " + vars );
+ logger.debug("===============AFTER lcmRulesController.exec Phase =============================");
+
+
+ for (String serviceId : vars.getOutParams().keySet()) {
+ if ( vars.getOutParams().get(serviceId) !=null) {
+ if ( vars.getOutParams().get(serviceId).equals( "true") ) {
+ tobeCreated.put( serviceId, true && tobeCreated.get(serviceId) );
+ } else {
+ tobeCreated.put( serviceId, false);
+ allSupportingServicesCreated = false;
+ }
+ }
+ }
+
+ serviceOrderManager.updateService( contextService.getId() , supd, false); //update context service
+
+ List servicesToCreate = new ArrayList<>();
+ for (String specid : tobeCreated.keySet()) {
+ if ( tobeCreated.get(specid) ) {
+ servicesToCreate.add(specid);
+ allSupportingServicesCreated = false;
+ }
+ }
+
+ if ( foundCreatedButNOTACTIVEServices ) {
+ allSupportingServicesCreatedAndActive = false;
+ }
+
+
+ //we need to put here cases to avoid deadlock on waiting too much
+ for ( ServiceRef serviceRef: contextService.getSupportingService() ) {
+
+ Service theServiceReferenced = serviceOrderManager.retrieveService( serviceRef.getId() );
+ if ( theServiceReferenced != null ) {
+ if ( theServiceReferenced.getState().equals( ServiceStateType.INACTIVE ) || theServiceReferenced.getState().equals( ServiceStateType.TERMINATED ) ) {
+ allSupportingServicesCreatedAndActive = true;
+ allSupportingServicesCreated = true;
+ break;// this will help us to avoid a deadlock if a failure occurs
+ }
+ }
+
+ }
+
+
+ execution.setVariable("allSupportingServicesCreated", allSupportingServicesCreated );
+ execution.setVariable("allSupportingServicesCreatedAndActive", allSupportingServicesCreatedAndActive && allSupportingServicesCreated ); //by default
+ execution.setVariable("parentServiceId", contextServiceId);
+ execution.setVariable("serviceSpecsToCreate", servicesToCreate);
+ }
+
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionAdd.java b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionAdd.java
new file mode 100644
index 0000000000000000000000000000000000000000..9eda1bcd822a9b64f64522039d5815718e30c1f0
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionAdd.java
@@ -0,0 +1,65 @@
+package org.etsi.osl.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@Component(value = "processOrderItemActionAdd") // bean name
+public class ProcessOrderItemActionAdd implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ProcessOrderItemActionAdd.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ProcessOrderItemActionAdd:" + execution.getVariableNames().toString());
+
+ logger.debug("Will process/orchestrate order with id = " + execution.getVariable("orderid"));
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderid"));
+ String orderItemIdToProcess = (String) execution.getVariable("orderItemId");
+ ServiceOrderItem soi = null;
+
+ for (ServiceOrderItem i : sor.getOrderItem()) {
+ if (i.getUuid().equals( orderItemIdToProcess )){
+ soi = i;
+ break;
+ }
+ }
+
+ if ( soi == null ) {
+ return;
+ }
+
+
+ ServiceSpecification spec = serviceOrderManager
+ .retrieveServiceSpec(soi.getService().getServiceSpecification().getId());
+ if ( (spec.isIsBundle()!=null) && spec.isIsBundle() ) {
+ execution.setVariable("isBundle", Boolean.TRUE );
+ } else {
+ execution.setVariable("isBundle", Boolean.FALSE );
+ }
+
+ execution.setVariable("serviceSpecID", spec.getId() );
+
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionCheck.java b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionCheck.java
new file mode 100644
index 0000000000000000000000000000000000000000..9b5c1233ca435816568e152c09d1f7a59aa91e29
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionCheck.java
@@ -0,0 +1,58 @@
+package org.etsi.osl.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderActionType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@Component(value = "processOrderItemActionCheck") // bean name
+public class ProcessOrderItemActionCheck implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ProcessOrderItemActionCheck.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ProcessOrderItemActionCheck:" + execution.getVariableNames().toString());
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderid"));
+ String orderItemIdToProcess = (String) execution.getVariable("orderItemId");
+ ServiceOrderItem soi = null;
+
+ for (ServiceOrderItem i : sor.getOrderItem()) {
+ if (i.getUuid().equals( orderItemIdToProcess )){
+ soi = i;
+ break;
+ }
+ }
+
+ if ( soi == null ) {
+ return;
+ }
+
+ if ( soi.getAction().equals( ServiceOrderActionType.ADD ) ) {
+ execution.setVariable("saction", "ADD");
+ } else if ( soi.getAction().equals( ServiceOrderActionType.MODIFY ) ) {
+ execution.setVariable("saction", "MODIFY");
+ }else if ( soi.getAction().equals( ServiceOrderActionType.DELETE ) ) {
+ execution.setVariable("saction", "DELETE");
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionComplete.java b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionComplete.java
new file mode 100644
index 0000000000000000000000000000000000000000..127552f3550846777d17e79cdfa845204ee35f5a
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionComplete.java
@@ -0,0 +1,35 @@
+package org.etsi.osl.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component(value = "processOrderItemActionComplete") // bean name
+public class ProcessOrderItemActionComplete implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ProcessOrderItemActionComplete.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ProcessOrderItemActionComplete:" + execution.getVariableNames().toString());
+
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionDelete.java b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionDelete.java
new file mode 100644
index 0000000000000000000000000000000000000000..cf6d2c7f20de19c3c5ea952bda4861766e238f50
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionDelete.java
@@ -0,0 +1,97 @@
+package org.etsi.osl.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderActionType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceRestriction;
+
+@Component(value = "processOrderItemActionDelete") // bean name
+public class ProcessOrderItemActionDelete implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ProcessOrderItemActionDelete.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ProcessOrderItemActionDelete:" + execution.getVariableNames().toString());
+
+ logger.debug("Will process/orchestrate order with id = " + execution.getVariable("orderid"));
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderid"));
+ String orderItemIdToProcess = (String) execution.getVariable("orderItemId");
+ ServiceOrderItem soi = null;
+
+ for (ServiceOrderItem i : sor.getOrderItem()) {
+ if (i.getUuid().equals( orderItemIdToProcess )){
+ soi = i;
+ break;
+ }
+ }
+
+ if ( soi == null ) {
+ return;
+ }
+
+ ServiceRestriction refservice = soi.getService();
+
+ /**
+ * we will terminate the services
+ */
+ if ( soi.getState().equals( ServiceOrderStateType.ACKNOWLEDGED ) ) {
+
+ for (ServiceRef sref : soi.getService().getSupportingService() ) {
+ ServiceUpdate supd = new ServiceUpdate();
+ supd.setState( ServiceStateType.TERMINATED );
+ serviceOrderManager.updateService( sref.getId(), supd , true);
+ }
+
+ }
+
+
+
+ soi.setState(ServiceOrderStateType.INPROGRESS);
+ soi.setAction( ServiceOrderActionType.NOCHANGE ); //reset the action to NOCHANGE
+
+
+ /***
+ * we can update now the serviceorder element in catalog
+ * Update also the related service attributes
+ */
+
+ ServiceOrderUpdate serviceOrderUpd = new ServiceOrderUpdate();
+ for (ServiceOrderItem orderItemItem : sor.getOrderItem()) {
+ orderItemItem.getService().setName( orderItemItem.getService().getServiceSpecification().getName() );
+ orderItemItem.getService().setCategory( orderItemItem.getService().getServiceSpecification().getType() );
+ //orderItemItem.getService().setState( ServiceStateType.RESERVED );
+ //orderItemItem.setAction( ServiceOrderActionType.NOCHANGE ); //reset the action to NOCHANGE
+
+ serviceOrderUpd.addOrderItemItem(orderItemItem);
+ }
+
+
+ serviceOrderManager.updateServiceOrderOrder( sor.getId(), serviceOrderUpd );
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionModify.java b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionModify.java
new file mode 100644
index 0000000000000000000000000000000000000000..ed7d7b2c317fe1a5479b89ca2405bb800a682476
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ProcessOrderItemActionModify.java
@@ -0,0 +1,126 @@
+package org.etsi.osl.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderActionType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceRestriction;
+
+@Component(value = "processOrderItemActionModify") // bean name
+public class ProcessOrderItemActionModify implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ProcessOrderItemActionModify.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ProcessOrderItemActionModify:" + execution.getVariableNames().toString());
+
+ logger.debug("Will process/orchestrate order with id = " + execution.getVariable("orderid"));
+ ServiceOrder sor = serviceOrderManager.retrieveServiceOrder((String) execution.getVariable("orderid"));
+ String orderItemIdToProcess = (String) execution.getVariable("orderItemId");
+ ServiceOrderItem soi = null;
+
+ for (ServiceOrderItem i : sor.getOrderItem()) {
+ if (i.getUuid().equals( orderItemIdToProcess )){
+ soi = i;
+ break;
+ }
+ }
+
+ if ( soi == null ) {
+ return;
+ }
+
+ ServiceRestriction refservice = soi.getService();
+
+ if ( soi.getState().equals( ServiceOrderStateType.ACKNOWLEDGED ) ) {
+
+
+ if ( refservice.getState().equals( ServiceStateType.INACTIVE)
+ || refservice.getState().equals( ServiceStateType.TERMINATED)) {
+
+
+ for (ServiceRef sref : soi.getService().getSupportingService() ) {
+ ServiceUpdate supd = new ServiceUpdate();
+ supd.setState( ServiceStateType.TERMINATED );
+ serviceOrderManager.updateService( sref.getId(), supd , true);
+ }
+ }
+ else {
+
+
+ //na doume to modify (me change characteristics apo to service restriction kai to terminate)
+ //copy characteristics values from Service restriction to supporting services.
+ for (ServiceRef sref : soi.getService().getSupportingService() ) {
+ Service aService = serviceOrderManager.retrieveService( sref.getId() );
+ ServiceUpdate supd = new ServiceUpdate();
+
+ if ( soi.getService().getServiceCharacteristic() != null ) {
+ for (Characteristic serviceChar : aService.getServiceCharacteristic() ) {
+
+ for (Characteristic soiCharacteristic : soi.getService().getServiceCharacteristic()) {
+ if ( soiCharacteristic.getName().contains( aService.getName() + "::" +serviceChar.getName() )) { //copy only characteristics that are related from the order
+
+ serviceChar.setValue( soiCharacteristic.getValue() );
+ supd.addServiceCharacteristicItem( serviceChar );
+ }
+ }
+ }
+
+
+ }
+
+
+ serviceOrderManager.updateService( aService.getId(), supd , true); //update the service
+ }
+ }
+
+ }
+
+
+ soi.setState(ServiceOrderStateType.INPROGRESS);
+ soi.setAction( ServiceOrderActionType.NOCHANGE ); //reset the action to NOCHANGE
+
+ /***
+ * we can update now the serviceorder element in catalog
+ * Update also the related service attributes
+ */
+
+ ServiceOrderUpdate serviceOrderUpd = new ServiceOrderUpdate();
+ for (ServiceOrderItem orderItemItem : sor.getOrderItem()) {
+ orderItemItem.getService().setName( orderItemItem.getService().getServiceSpecification().getName() );
+ orderItemItem.getService().setCategory( orderItemItem.getService().getServiceSpecification().getType() );
+
+ serviceOrderUpd.addOrderItemItem(orderItemItem);
+ }
+
+
+ serviceOrderManager.updateServiceOrderOrder( sor.getId(), serviceOrderUpd );
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/ServiceOrderManager.java b/src/main/java/org/etsi/osl/osom/management/ServiceOrderManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..e745d3032b7784a7087cc0290884d3851ecde2d6
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/ServiceOrderManager.java
@@ -0,0 +1,1063 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.model.dataformat.JsonLibrary;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.serviceactions.NSActionRequestPayload;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.TaskService;
+import org.flowable.task.api.Task;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.model.NetworkServiceDescriptor;
+import org.etsi.osl.model.ScaleDescriptor;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.rcm634.model.ResourceSpecification;
+import org.etsi.osl.tmf.ri639.model.LogicalResource;
+import org.etsi.osl.tmf.ri639.model.PhysicalResource;
+import org.etsi.osl.tmf.ri639.model.Resource;
+import org.etsi.osl.tmf.ri639.model.ResourceCreate;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceCreate;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderCreate;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+import org.etsi.osl.tmf.stm653.model.ServiceTest;
+import org.etsi.osl.tmf.stm653.model.ServiceTestCreate;
+import org.etsi.osl.tmf.stm653.model.ServiceTestSpecification;
+import org.etsi.osl.tmf.stm653.model.ServiceTestUpdate;
+import jakarta.validation.constraints.NotNull;
+
+/**
+ * @author ctranoris
+ *
+ */
+@Service
+public class ServiceOrderManager {
+
+ private static final transient Log logger = LogFactory.getLog(ServiceOrderManager.class.getName());
+
+ private static final String ORDER_ASSIGNEE = "admin";
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private TaskService taskService;
+
+ @Autowired
+ private ProducerTemplate template;
+
+
+
+ @Value("${CATALOG_GET_SERVICEORDER_BY_ID}")
+ private String CATALOG_GET_SERVICEORDER_BY_ID = "";
+
+
+ @Value("${CATALOG_GET_SERVICESPEC_BY_ID}")
+ private String CATALOG_GET_SERVICESPEC_BY_ID = "";
+
+// @Value("${CATALOG_GET_INITIAL_SERVICEORDERS_IDS}")
+// private String CATALOG_GET_INITIAL_SERVICEORDERS_IDS = "";
+
+ @Value("${CATALOG_GET_SERVICEORDER_IDS_BY_STATE}")
+ private String CATALOG_GET_SERVICEORDER_IDS_BY_STATE = "";
+
+ @Value("${CATALOG_UPD_SERVICEORDER_BY_ID}")
+ private String CATALOG_UPD_SERVICEORDER_BY_ID = "";
+
+
+ @Value("${CATALOG_ADD_SERVICEORDER}")
+ private String CATALOG_ADD_SERVICEORDER = "";
+
+
+ @Value("${CATALOG_ADD_SERVICE}")
+ private String CATALOG_ADD_SERVICE = "";
+
+ @Value("${CATALOG_UPD_SERVICE}")
+ private String CATALOG_UPD_SERVICE = "";
+
+ @Value("${CATALOG_GET_SERVICE_BY_ID}")
+ private String CATALOG_GET_SERVICE_BY_ID = "";
+
+ @Value("${CATALOG_GET_SERVICE_BY_ORDERID}")
+ private String CATALOG_GET_SERVICE_BY_ORDERID = "";
+
+
+
+ @Value("${CATALOG_SERVICE_QUEUE_ITEMS_GET}")
+ private String CATALOG_SERVICE_QUEUE_ITEMS_GET = "";
+
+ @Value("${CATALOG_SERVICE_QUEUE_ITEM_UPD}")
+ private String CATALOG_SERVICE_QUEUE_ITEM_UPD = "";
+
+ @Value("${CATALOG_SERVICE_QUEUE_ITEM_DELETE}")
+ private String CATALOG_SERVICE_QUEUE_ITEM_DELETE = "";
+
+
+ @Value("${CATALOG_SERVICES_TO_TERMINATE}")
+ private String CATALOG_SERVICES_TO_TERMINATE = "";
+
+ @Value("${CATALOG_SERVICES_OF_PARTNERS}")
+ private String CATALOG_SERVICES_OF_PARTNERS = "";
+
+ @Value("${NFV_CATALOG_DEPLOY_NSD_REQ}")
+ private String NFV_CATALOG_DEPLOY_NSD_REQ = "";
+
+
+ @Value("${NFV_CATALOG_GET_DEPLOYMENT_BY_ID}")
+ private String NFV_CATALOG_GET_DEPLOYMENT_BY_ID = "";
+
+
+ @Value("${NFV_CATALOG_GET_NSD_BY_ID}")
+ private String NFV_CATALOG_GET_NSD_BY_ID = "";
+
+
+ @Value("${NFV_CATALOG_UPD_DEPLOYMENT_BY_ID}")
+ private String NFV_CATALOG_UPD_DEPLOYMENT_BY_ID = "";
+
+ @Value("${CATALOG_GET_PARTNER_ORGANIZATON_BY_ID}")
+ private String CATALOG_GET_PARTNER_ORGANIZATON_BY_ID = "";
+
+ @Value("${NFV_CATALOG_NS_DAY2_ACTION}")
+ private String NFV_CATALOG_NS_DAY2_ACTION = "";
+
+ @Value("${NFV_CATALOG_NSACTIONS_SCALE}")
+ private String NFV_CATALOG_NSACTIONS_SCALE = "";
+
+
+ @Value("${CATALOG_GET_SERVICETESTSPEC_BY_ID}")
+ private String CATALOG_GET_SERVICETESTSPEC_BY_ID = "";
+
+ @Value("${CATALOG_ADD_SERVICETEST}")
+ private String CATALOG_ADD_SERVICETEST = "";
+
+ @Value("${CATALOG_UPD_SERVICETEST}")
+ private String CATALOG_UPD_SERVICETEST = "";
+
+ @Value("${CATALOG_GET_SERVICETEST_BY_ID}")
+ private String CATALOG_GET_SERVICETEST_BY_ID = "";
+
+
+
+ @Value("${CRD_DEPLOY_CR_REQ}")
+ private String CRD_DEPLOY_CR_REQ = "";
+
+ @Value("${CRD_PATCH_CR_REQ}")
+ private String CRD_PATCH_CR_REQ = "";
+
+ @Value("${CRD_DELETE_CR_REQ}")
+ private String CRD_DELETE_CR_REQ = "";
+
+ @Value("${CATALOG_ADD_RESOURCE}")
+ private String CATALOG_ADD_RESOURCE = "";
+
+ @Value("${CATALOG_GET_RESOURCE_BY_ID}")
+ private String CATALOG_GET_RESOURCE_BY_ID = "";
+
+
+
+ @Transactional
+ public void processOrder(ServiceOrder serviceOrder) {
+
+ logger.info("Received order to process serviceOrder id : " + serviceOrder.getId());
+ Map variables = new HashMap<>();
+ variables.put("orderid", serviceOrder.getId());
+
+ runtimeService.startProcessInstanceByKey("InitialServiceOrderAckProcess", variables);
+ }
+
+ @Transactional
+ public List getTasks(String assignee) {
+ /**
+ * we ignore for now the assignee
+ */
+ String assign = ORDER_ASSIGNEE;
+ logger.info("Received order to getTasks, assignee : " + assign);
+ List tasks = taskService.createTaskQuery().taskCandidateGroup(assign).list();
+
+ List orders = tasks.stream().map(task -> {
+ Map variables = taskService.getVariables(task.getId());
+ return (String) variables.get("orderid");
+ }).collect(Collectors.toList());
+
+ logger.info("orderid(s) : " + orders.toString());
+ return orders;
+ }
+
+
+
+ @Transactional
+ public void humanComplete(String id) {
+ logger.info("Received Order manual complete for orderid=" +id );
+ /**
+ * we ignore for now the assignee
+ */
+ String assignee = ORDER_ASSIGNEE;
+
+ List tasks = taskService.createTaskQuery()
+ .taskDefinitionKey("usertaskManualCompleteOrder")
+ // .taskCandidateGroup( assignee )
+ .list();
+ String taskId = null;
+
+ for (Task t : tasks) {
+ logger.info("PENDING humanComplete t.id=" + t.getId() + "" + "orderid=" + taskService.getVariables(t.getId()).get("orderid") );
+ String orderid= (String) taskService.getVariables(t.getId()).get("orderid");
+ if ( orderid.contains( id )) {
+ taskId = t.getId();
+ if (taskId != null) {
+
+ logger.info("will complete orderid=" +id );
+ taskService.complete(taskId);
+ } else {
+
+ logger.error("Task ID cannot be found for received OrderApproval for orderid=" + id);
+ }
+ }
+
+
+ }
+
+ }
+
+// /**
+// * Request orders to be processed
+// * @return a string list of Order IDs
+// */
+// public List retrieveOrdersToBeProcessed() {
+// logger.info("will retrieve Service Orders to be processed from catalog " );
+// try {
+// Map map = new HashMap<>();
+// map.put("orderstate", ServiceOrderStateType.ACKNOWLEDGED.toString() );
+//
+// Object response = template.
+// requestBodyAndHeaders( CATALOG_GET_SERVICEORDER_IDS_BY_STATE, "", map );
+//
+// logger.info("will retrieve Service OrdersACKNOWLEDGED from catalog response: " + response.getClass() );
+// if ( !(response instanceof String)) {
+// logger.error("List object is wrong.");
+// return null;
+// }
+// //String[] sor = toJsonObj( (String)response, String[].class );
+//
+// ArrayList sor = toJsonObj( (String)response, ArrayList.class );
+// logger.debug("retrieveOrdersToBeProcessed response is: " + response);
+//
+//// return asList(sor);
+// return sor;
+//
+// }catch (Exception e) {
+// logger.error("Cannot retrieve Listof Service Orders ACKNOWLEDGED from catalog. " + e.toString());
+// }
+// return null;
+// }
+
+
+ /**
+ * @return
+ */
+ public List retrieveOrdersByState(ServiceOrderStateType orderState) {
+ logger.info("will retrieve Service Orders " + orderState.toString() + " from catalog " );
+ try {
+ Map map = new HashMap<>();
+ map.put("orderstate", orderState.toString() );
+ Object response = template.
+ requestBodyAndHeaders( CATALOG_GET_SERVICEORDER_IDS_BY_STATE, "", map );
+
+ logger.debug("will retrieve Service Orders " + orderState.toString() + " from catalog response: " + response.getClass() );
+ if ( !(response instanceof String)) {
+ logger.error("List object is wrong.");
+ return null;
+ }
+ //String[] sor = toJsonObj( (String)response, String[].class );
+
+ ArrayList sor = toJsonObj( (String)response, ArrayList.class );
+ logger.debug("retrieveOrdersByState response is: " + response);
+
+// return asList(sor);
+ return sor;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Listof Service Orders "+ orderState.toString() + " from catalog. " + e.toString());
+ }
+ return null;
+ }
+ /**
+ * get service order by id from model via bus
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public ServiceOrder retrieveServiceOrder( String orderid) {
+ logger.info("will retrieve Service Order from catalog orderid=" + orderid );
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_SERVICEORDER_BY_ID, orderid);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Order object is wrong.");
+ return null;
+ }
+ logger.debug("retrieveServiceOrder response is: " + response);
+ ServiceOrder sor = toJsonObj( (String)response, ServiceOrder.class);
+
+ return sor;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Service Order details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+
+
+ public void updateServiceOrderOrder(String orderid, ServiceOrderUpdate serviceOrder) {
+ logger.info("will set Service Order in progress orderid=" + orderid );
+ try {
+
+ template.sendBodyAndHeader( CATALOG_UPD_SERVICEORDER_BY_ID, toJsonString(serviceOrder), "orderid", orderid);
+
+
+ }catch (Exception e) {
+ logger.error("Cannot set Service Order status from catalog. " + e.toString());
+ }
+
+ }
+
+ public ServiceOrder createServiceOrder(ServiceOrderCreate serviceOrderCreate) {
+ logger.info("will create Service Order " );
+ try {
+
+
+ try {
+ Object response = template.
+ requestBody( CATALOG_ADD_SERVICEORDER, toJsonString(serviceOrderCreate));
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Order object is wrong.");
+ return null;
+ }
+ logger.debug("createServiceOrder response is: " + response);
+ ServiceOrder sor = toJsonObj( (String)response, ServiceOrder.class);
+
+ return sor;
+
+ }catch (Exception e) {
+ logger.error("Cannot createServiceOrder details to catalog. " + e.toString());
+ }
+ return null;
+
+
+
+
+ }catch (Exception e) {
+ logger.error("Cannot createServiceOrder to catalog. " + e.toString());
+ }
+ return null;
+
+ }
+
+
+ /**
+ * get service spec by id from model via bus
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public ServiceSpecification retrieveServiceSpec(String specid) {
+ logger.info("will retrieve Service Specification from catalog orderid=" + specid );
+
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_SERVICESPEC_BY_ID, specid);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Specification object is wrong.");
+ return null;
+ }
+ ServiceSpecification sor = toJsonObj( (String)response, ServiceSpecification.class);
+ //logger.debug("retrieveSpec response is: " + response);
+ return sor;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Service Specification details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+
+
+ public org.etsi.osl.tmf.sim638.model.Service createService( ServiceCreate s, ServiceOrder sor, ServiceSpecification spec) {
+ logger.info("will create Service for spec: " + spec.getId() );
+ try {
+ Map map = new HashMap<>();
+ map.put("orderid", sor.getId() );
+ map.put("serviceSpecid", spec.getId() );
+ Object response = template.requestBodyAndHeaders( CATALOG_ADD_SERVICE, toJsonString(s), map);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Instance object is wrong.");
+ }
+
+ org.etsi.osl.tmf.sim638.model.Service serviceInstance = toJsonObj( (String)response, org.etsi.osl.tmf.sim638.model.Service.class);
+ //logger.debug("createService response is: " + response);
+ return serviceInstance;
+
+
+ }catch (Exception e) {
+ logger.error("Cannot create Service for spec " + spec.getId()+ ": " + e.toString());
+ }
+ return null;
+
+ }
+
+ /**
+ * @param serviceId
+ * @param s
+ * @param propagateToSO is a cryptic thing. However it is used as follows: if FALSE, to just update the service status in catalog without further taking any action.
+ * if TRUE then the ServiceUpdate will trigger a ServiceActionQueue to further process the update. So this is needed to avoid these kinds of deadlocks
+ * @return
+ */
+ public org.etsi.osl.tmf.sim638.model.Service updateService(String serviceId, ServiceUpdate s, boolean propagateToSO) {
+ logger.info("will update Service : " + serviceId );
+ try {
+ Map map = new HashMap<>();
+ map.put("serviceid", serviceId );
+ map.put("propagateToSO", propagateToSO );
+
+ Object response = template.requestBodyAndHeaders( CATALOG_UPD_SERVICE, toJsonString(s), map);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Instance object is wrong.");
+ }
+
+ org.etsi.osl.tmf.sim638.model.Service serviceInstance = toJsonObj( (String)response, org.etsi.osl.tmf.sim638.model.Service.class);
+ //logger.debug("createService response is: " + response);
+ return serviceInstance;
+
+
+ }catch (Exception e) {
+ logger.error("Cannot update Service: " + serviceId + ": " + e.toString());
+ }
+ return null;
+
+ }
+
+
+
+
+ /**
+ * Ger service instance via bus
+ * @param serviceID
+ * @return
+ */
+ public org.etsi.osl.tmf.sim638.model.Service retrieveService(String serviceID) {
+ logger.info("will retrieve Service instance from catalog serviceID=" + serviceID );
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_SERVICE_BY_ID, serviceID);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service object is wrong.");
+ return null;
+ }
+ org.etsi.osl.tmf.sim638.model.Service serviceInstance = toJsonObj( (String)response, org.etsi.osl.tmf.sim638.model.Service.class);
+ //logger.debug("retrieveService response is: " + response);
+ return serviceInstance;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Service details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+
+
+
+
+ static T toJsonObj(String content, Class valueType) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.readValue( content, valueType);
+ }
+
+ static String toJsonString(Object object) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.writeValueAsString(object);
+ }
+
+
+ public DeploymentDescriptor nfvoDeploymentRequestByNSDid( DeploymentDescriptor ddreq ) {
+
+ if (ddreq == null) {
+ logger.fatal("nfvoDeploymentRequestByNSDid ddreq is NULL!" );
+ return null;
+ }
+
+ if (ddreq.getExperiment() == null) {
+ logger.fatal("nfvoDeploymentRequestByNSDid ddreq.getExperiment() is NULL!" );
+ return null;
+ }
+
+ logger.info("Will request by NFV Catalog to deploy NSD id= " + ddreq.getExperiment().getId() );
+
+ try {
+
+ String body = toJsonString(ddreq);
+ Object response = template.requestBodyAndHeader( NFV_CATALOG_DEPLOY_NSD_REQ, body , "id", ddreq.getExperiment().getId());
+
+ if ( !(response instanceof String)) {
+ logger.error("DeploymentDescriptor object is wrong.");
+ return null;
+ }
+ DeploymentDescriptor dd = toJsonObj( (String)response, DeploymentDescriptor.class);
+ logger.debug("nfvoDeploymentRequestByNSDid response is: " + response);
+ return dd;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve DeploymentDescriptor details from NFV catalog. " + e.toString());
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public DeploymentDescriptor retrieveNFVODeploymentRequestById(long deploymentId) {
+
+ logger.info("Will request by NFV Catalog detaile of DeploymentRequest= " + deploymentId );
+
+ try {
+
+ Object response = template.requestBody( NFV_CATALOG_GET_DEPLOYMENT_BY_ID, deploymentId );
+
+ if ( !(response instanceof String)) {
+ logger.error("DeploymentDescriptor object is wrong.");
+ return null;
+ }
+ DeploymentDescriptor dd = toJsonObj( (String)response, DeploymentDescriptor.class);
+ logger.debug("retriveNFVODeploymentRequestById response is: " + response);
+ return dd;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve DeploymentDescriptor details from NFV catalog. " + e.toString());
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public DeploymentDescriptor nfvoDeploymentRequestUpdate( DeploymentDescriptor ddreq ) {
+
+
+ logger.info("Will update nfvoDeploymentRequestUpdate = " + ddreq.getId() );
+
+ try {
+
+ String body = toJsonString(ddreq);
+ Object response = template.requestBodyAndHeader( NFV_CATALOG_UPD_DEPLOYMENT_BY_ID, body , "id", ddreq.getId());
+
+ if ( !(response instanceof String)) {
+ logger.error("DeploymentDescriptor object is wrong.");
+ return null;
+ }
+ DeploymentDescriptor dd = toJsonObj( (String)response, DeploymentDescriptor.class);
+ logger.debug("nfvoDeploymentRequestUpdate response is: " + response);
+ return dd;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve DeploymentDescriptor details from NFV catalog. " + e.toString());
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+
+ /**
+ *
+ * execute Day2 action
+ * @param nsp is a JSON string from class NSActionRequestPayload
+ * @return
+ */
+ public String nfvoDay2Action(NSActionRequestPayload nsp) {
+
+ logger.info("Will act NFV_CATALOG_NS_DAY2_ACTION = " + nsp );
+
+ try {
+
+ String body = toJsonString(nsp);
+ Object response = template.requestBody( NFV_CATALOG_NS_DAY2_ACTION, body);
+
+ if ( !(response instanceof String)) {
+ logger.error("nfvoDay2Action result is wrong.");
+ return null;
+ }
+
+ logger.debug("nfvoDay2Action response is: " + response);
+ return (String) response;
+
+ }catch (Exception e) {
+ logger.error("Cannot perform nfvoDay2Action. " + e.toString());
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * get service order by id from model via bus
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public NetworkServiceDescriptor retrieveNSD( String nsdID) {
+ logger.info("will retrieve NetworkServiceDescriptor from NSD/VNF catalog nsdID=" + nsdID );
+ try {
+ Object response = template.
+ requestBody( NFV_CATALOG_GET_NSD_BY_ID, nsdID);
+
+ if ( !(response instanceof String)) {
+ logger.error("NetworkServiceDescriptor object is wrong.");
+ return null;
+ }
+ NetworkServiceDescriptor sor = toJsonObj( (String)response, NetworkServiceDescriptor.class);
+ //logger.debug("retrieveServiceOrder response is: " + response);
+ return sor;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve NetworkServiceDescriptor details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+ public Organization getExternalPartnerOrganization(String partnerId) {
+
+ logger.info("will retrieve External Partner from catalog partnerId=" + partnerId );
+
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_PARTNER_ORGANIZATON_BY_ID, partnerId);
+
+ if ( !(response instanceof String)) {
+ logger.error("External Partner object is wrong.");
+ return null;
+ }
+ Organization orgz = toJsonObj( (String)response, Organization.class);
+ //logger.debug("retrieveSpec response is: " + response);
+ return orgz;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve External Partner details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+
+ //CATALOG_SERVICE_QUEUE_ITEMS_GET
+ public List retrieveServiceQueueItems() {
+ logger.debug("will retrieve Service QueueItems from repository" );
+ try {
+
+ Object response = template.
+ requestBody( CATALOG_SERVICE_QUEUE_ITEMS_GET, "" );
+
+ if ( !(response instanceof String)) {
+ logger.error("List object is wrong.");
+ return null;
+ }
+ //String[] sor = toJsonObj( (String)response, String[].class );
+
+ ServiceActionQueueItem[] sor = toJsonObj( (String)response, ServiceActionQueueItem[].class );
+ logger.debug("retrieveServiceQueueItems response is: " + response);
+
+// return asList(sor);
+ return Arrays.asList(sor);
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Listof Service QueueItems . " + e.toString());
+ }
+ return null;
+ }
+
+ public void deleteServiceActionQueueItem(ServiceActionQueueItem item) {
+
+ //
+ logger.info("will delete Service QueueItems from repository itemid : " + item.getUuid() );
+ try {
+
+ String body = toJsonString(item);
+
+ Map map = new HashMap<>();
+ map.put("itemid", item.getUuid() );
+ Object response = template.requestBodyAndHeaders( CATALOG_SERVICE_QUEUE_ITEM_DELETE, body, map);
+
+
+
+ }catch (Exception e) {
+ logger.error("Cannot update itemid: " + item.getUuid() + ": " + e.toString());
+ }
+
+ }
+
+ public List retrieveActiveServiceToTerminate() {
+ logger.info("will retrieve ActiveServiceToTerminate" );
+ try {
+
+ Object response = template.
+ requestBody( CATALOG_SERVICES_TO_TERMINATE, "" );
+
+ logger.debug("will retrieve ActiveServiceToTerminate response: " + response.getClass() );
+ if ( !(response instanceof String)) {
+ logger.error("List object is wrong.");
+ return null;
+ }
+ //String[] sor = toJsonObj( (String)response, String[].class );
+
+ String[] sor = toJsonObj( (String)response, String[].class );
+ logger.debug("retrieveActiveServiceToTerminate response is: " + response);
+
+// return asList(sor);
+ return Arrays.asList(sor);
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Listof ActiveServiceToTerminate . " + e.toString());
+ }
+ return null;
+ }
+
+ public String nfvoScaleDescriptorAction(ScaleDescriptor aScaleDescriptor) {
+
+
+ try {
+
+ String body = toJsonString(aScaleDescriptor);
+ Object response = template.requestBodyAndHeader( NFV_CATALOG_NSACTIONS_SCALE, body , "id", aScaleDescriptor.getDeploymentRequestID() );
+
+ if ( !(response instanceof String)) {
+ logger.error(" nfvoScaleDescriptorAction response object is wrong.");
+ return null;
+ }
+ //String dd = toJsonObj( (String)response, DeploymentDescriptor.class);
+ logger.debug("nfvoScaleDescriptorAction response is: " + response);
+ return (String) response;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve nfvoScaleDescriptorAction details from NFV catalog. " + e.toString());
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public List retrieveActiveServiceOfExternalPartners() {
+ logger.info("will retrieve ActiveServiceOfExternalPartners" );
+ try {
+
+ Object response = template.
+ requestBody( CATALOG_SERVICES_OF_PARTNERS, "" );
+
+ logger.debug("will retrieve ActiveServiceOfExternalPartners response: " + response.getClass() );
+ if ( !(response instanceof String)) {
+ logger.error("List object is wrong.");
+ return null;
+ }
+
+ String[] sor = toJsonObj( (String)response, String[].class );
+ logger.debug("ActiveServiceOfExternalPartners response is: " + response);
+
+// return asList(sor);
+ return Arrays.asList(sor);
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Listof ActiveServiceOfExternalPartners . " + e.toString());
+ }
+ return null;
+ }
+
+
+ /**
+ * Ger service instance IDs via bus CATALOG_GET_SERVICE_BY_ORDERID
+ * @param serviceIDorderID
+ * @return List
+ */
+ public List retrieveServicesOfOrder(String orderID) {
+ logger.info("will retrieve ActiveServiceOfExternalPartners" );
+ try {
+
+ Object response = template.
+ requestBody( CATALOG_GET_SERVICE_BY_ORDERID, orderID );
+
+ logger.debug("will retrieve ServicesOfOrder response: " + response.getClass() );
+ if ( !(response instanceof String)) {
+ logger.error("List object is wrong.");
+ return null;
+ }
+
+ String[] sor = toJsonObj( (String)response, String[].class );
+ logger.debug("ServicesOfOrder response is: " + response);
+
+ return Arrays.asList(sor);
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Listof ServicesOfOrder . " + e.toString());
+ }
+ return null;
+ }
+
+
+ /**
+ * get service Test spec by id from model via bus
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public ServiceTestSpecification retrieveServiceTestSpec(String specid) {
+ logger.info("will retrieve Service Test Specification from catalog orderid=" + specid );
+
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_SERVICETESTSPEC_BY_ID, specid);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Test Specification object is wrong.");
+ return null;
+ }
+ ServiceTestSpecification sor = toJsonObj( (String)response, ServiceTestSpecification.class);
+ //logger.debug("retrieveSpec response is: " + response);
+ return sor;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve Service Test Specification details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+ public ServiceTest createServiceTest( ServiceTestCreate s, ServiceOrder sor, ServiceTestSpecification spec) {
+ logger.info("will create Service Test for spec: " + spec.getId() );
+ try {
+ Map map = new HashMap<>();
+ map.put("orderid", sor.getId() );
+ map.put("serviceTestSpecid", spec.getId() );
+ Object response = template.requestBodyAndHeaders( CATALOG_ADD_SERVICETEST, toJsonString(s), map);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Instance object is wrong.");
+ }
+
+ ServiceTest serviceInstance = toJsonObj( (String)response, ServiceTest.class);
+ //logger.debug("createService response is: " + response);
+ return serviceInstance;
+
+
+ }catch (Exception e) {
+ logger.error("Cannot create Service for spec " + spec.getId()+ ": " + e.toString());
+ }
+ return null;
+
+ }
+
+ /**
+ * @param serviceId
+ * @param s
+ * @return
+ */
+ public ServiceTest updateServiceTest(String serviceId, ServiceTestUpdate s) {
+ logger.info("will update Service : " + serviceId );
+ try {
+ Map map = new HashMap<>();
+ map.put("serviceid", serviceId );
+
+ Object response = template.requestBodyAndHeaders( CATALOG_UPD_SERVICETEST, toJsonString(s), map);
+
+ if ( !(response instanceof String)) {
+ logger.error("ServiceTest Instance object is wrong.");
+ }
+
+ ServiceTest serviceInstance = toJsonObj( (String)response, ServiceTest.class);
+
+ return serviceInstance;
+
+
+ }catch (Exception e) {
+ logger.error("Cannot update ServiceTest: " + serviceId + ": " + e.toString());
+ }
+ return null;
+
+ }
+
+
+ /**
+ * Ger ServiceTest instance via bus
+ * @param serviceID
+ * @return
+ */
+ public ServiceTest retrieveServiceTest(String serviceID) {
+ logger.info("will retrieve ServiceTest instance from catalog serviceID=" + serviceID );
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_SERVICETEST_BY_ID, serviceID);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service object is wrong.");
+ return null;
+ }
+ ServiceTest serviceInstance = toJsonObj( (String)response, ServiceTest.class);
+ //logger.debug("retrieveService response is: " + response);
+ return serviceInstance;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve ServiceTest details from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+
+ public Resource createResource(ResourceCreate s, ServiceOrder sor, String resourceSpecid) {
+
+
+ logger.info("will create Resource for spec: " + resourceSpecid );
+ try {
+ Map map = new HashMap<>();
+ map.put("orderid", sor.getId() );
+ map.put("resourceSpecid", resourceSpecid );
+ Object response = template.requestBodyAndHeaders( CATALOG_ADD_RESOURCE, toJsonString(s), map);
+
+ if ( !(response instanceof String)) {
+ logger.error("Resource Instance object is wrong.");
+ }
+
+ //logger.debug("createResource response is: " + response);
+ try {
+ LogicalResource resourceInstance = toJsonObj( (String)response, LogicalResource.class);
+ return resourceInstance;
+ }catch (Exception e) {
+ PhysicalResource resourceInstance = toJsonObj( (String)response, PhysicalResource.class);
+ return resourceInstance;
+ }
+
+
+ }catch (Exception e) {
+ logger.error("Cannot create Resource for spec " + resourceSpecid + ": " + e.toString());
+ }
+ return null;
+ }
+
+ public Resource retrieveResource(@NotNull String resourceID) {
+ logger.info("will retrieve Resource instance from catalog resourceID=" + resourceID );
+ try {
+ Object response = template.
+ requestBody( CATALOG_GET_RESOURCE_BY_ID, resourceID);
+
+ if ( !(response instanceof String)) {
+ logger.error("resource object is wrong.");
+ return null;
+ }
+ LogicalResource rInstance = toJsonObj( (String)response, LogicalResource.class);
+
+ return rInstance;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve LogicalResource details from catalog. " + e.toString());
+ }
+ return null;
+
+ }
+
+ /**
+ * @param rFS_CRSPEC
+ * @param serviceId
+ *
+ */
+ public String cridgeDeploymentRequest(Map map, String CR_SPEC) {
+
+
+ try {
+
+
+
+ //Object response = template.requestBodyAndHeaders( CRD_DEPLOY_CR_REQ, CR_SPEC , map );
+ //see OSOMRouteBuilder.class
+ Object response = template.requestBodyAndHeaders( "direct:retriesCRD_DEPLOY_CR_REQ", CR_SPEC , map );
+
+
+ if ( !(response instanceof String)) {
+ logger.error("cridgeDeploymentRequest response object is wrong.");
+ return null;
+ }
+ logger.debug("cridgeDeploymentRequest response is: " + response);
+ return (String) response;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve cridgeDeploymentRequestresponse. " + e.toString());
+ e.printStackTrace();
+ }
+ return null;
+
+ }
+
+
+
+ /**
+ * @param map
+ * @param crspec
+ */
+ public String cridgeDeletionRequest(Map map, String CR_SPEC) {
+
+ try {
+
+ Object response = template.requestBodyAndHeaders( CRD_DELETE_CR_REQ, CR_SPEC , map );
+
+ if ( !(response instanceof String)) {
+ logger.error("cridgeDeletionRequest response object is wrong.");
+ return null;
+ }
+ logger.debug("cridgeDeletionRequest response is: " + response);
+ return (String) response;
+
+ }catch (Exception e) {
+ logger.error("Cannot retrieve cridgeDeletionRequest. " + e.toString());
+ e.printStackTrace();
+ }
+ return null;
+
+
+ }
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/management/UserOrderCompleteService.java b/src/main/java/org/etsi/osl/osom/management/UserOrderCompleteService.java
new file mode 100644
index 0000000000000000000000000000000000000000..3cd49cc0211398954ef1b86f55a8e8c9d6d6a1d2
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/management/UserOrderCompleteService.java
@@ -0,0 +1,83 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.sim638.model.Service;
+
+
+@Component(value = "userOrderCompleteService") //bean name
+public class UserOrderCompleteService implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(UserOrderCompleteService.class.getName());
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+ logger.info("UserOrderCompleteService:" + execution.getVariableNames().toString());
+
+ logger.info( execution.getVariableNames().toString() );
+ logger.info("contextServiceId:" + execution.getVariable("contextServiceId").toString() );
+ logger.info("orderid:" + execution.getVariable("orderid").toString() );
+
+ execution.setVariable("serviceHandledManually", Boolean.TRUE );
+
+ if (execution.getVariable("contextServiceId") instanceof String) {
+ Service s = serviceOrderManager.retrieveService( (String) execution.getVariable("contextServiceId") );
+ logger.info("Service name:" + s.getName() );
+ logger.info("Service state:" + s.getState() );
+
+
+
+ if ( !s.getState().equals(ServiceStateType.RESERVED) ) {
+ execution.setVariable("serviceHandledManually", Boolean.TRUE );
+ } else {
+ execution.setVariable("serviceHandledManually", Boolean.FALSE );
+ }
+
+
+// ServiceUpdate supd = new ServiceUpdate();
+//
+// Note noteItem = new Note();
+// noteItem.setText("Service will be handled by " + execution.getVariable("brokeActivity" ));
+//
+// noteItem.setAuthor( compname );
+//
+// supd.addNoteItem(noteItem);
+// serviceOrderManager.updateService( (String)execution.getVariable("contextServiceId") , supd, false);
+
+ }
+
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/FetchPartnerOrganizations.java b/src/main/java/org/etsi/osl/osom/partnerservices/FetchPartnerOrganizations.java
new file mode 100644
index 0000000000000000000000000000000000000000..26539751c8d1b5c9ea60dc92af0b5832b98039eb
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/FetchPartnerOrganizations.java
@@ -0,0 +1,73 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.TaskService;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.pm632.model.Organization;
+
+@Component(value = "fetchPartnerOrganizations") // bean name
+public class FetchPartnerOrganizations implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(FetchPartnerOrganizations.class.getName());
+
+ @Autowired
+ private TaskService taskService;
+
+ @Autowired
+ PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+ public void execute(DelegateExecution execution) {
+ logger.info("=========== FetchPartnerOrganizations by Repository " + execution.getProcessDefinitionId() + "======================================");
+ logger.info("FetchPartnerOrganizations by Repository");
+
+ List partnerList = partnerOrganizationServicesManager.retrievePartners();
+
+ List partnerListAsString = new ArrayList<>();
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ if ( partnerList!=null) {
+ for (Organization organization : partnerList) {
+ String o = mapper.writeValueAsString(organization);
+ partnerListAsString.add(o);
+ }
+ }
+
+ execution.setVariable("partnerOrganizations", partnerListAsString);
+
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/FetchUpdateExternalPartnerServices.java b/src/main/java/org/etsi/osl/osom/partnerservices/FetchUpdateExternalPartnerServices.java
new file mode 100644
index 0000000000000000000000000000000000000000..343f6f4b0ee0396bab5c18540ed1f17951902a1a
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/FetchUpdateExternalPartnerServices.java
@@ -0,0 +1,126 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.pm632.model.Characteristic;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+
+@Component(value = "fetchUpdateExternalPartnerServices") // bean name
+public class FetchUpdateExternalPartnerServices implements JavaDelegate {
+
+
+ @Autowired
+ PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+ @Override
+ public void execute(DelegateExecution execution) {
+ if ( (execution.getVariable("partnerOrganization")!=null) && (execution.getVariable("partnerOrganization") instanceof String )) {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ Organization org;
+ try {
+ org = mapper.readValue( execution.getVariable("partnerOrganization").toString(), Organization.class);
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+
+ /**
+ * Fetch partner service specs. For now there is no criteria and we fetch all in one json...
+ */
+ if (
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID")!=null ) &&
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2TOKENURI")!=null ) &&
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_USERNAME")!=null ) &&
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_BASEURL") != null) &&
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID").getValue() != null) &&
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2TOKENURI").getValue() != null) &&
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_USERNAME").getValue() != null) &&
+ ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_BASEURL").getValue() != null) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID").getValue().getValue().equals("") ) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2TOKENURI").getValue().getValue().equals("") ) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_USERNAME").getValue().getValue().equals("") ) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_BASEURL").getValue().getValue().equals("") )
+ ) {
+
+
+
+ List specs = partnerOrganizationServicesManager.fetchServiceSpecs( org );
+
+ for (ServiceSpecification serviceSpecification : specs) {
+ /**
+ * add to the spec, the organization as related party
+ */
+
+ serviceSpecification.getRelatedParty().clear();//clear all related parties if any
+ serviceSpecification.getAttachment().clear();
+ if ( serviceSpecification.getDescription() == null ) {
+ serviceSpecification.setDescription( "Service from Organization: " + org.getName() + ", id: " + org.getId() );
+ } else {
+ serviceSpecification.setDescription( "Service from Organization: " + org.getName() + ", id: " + org.getId() + ". " + serviceSpecification.getDescription());
+
+ }
+
+
+
+ partnerOrganizationServicesManager.updateSpecInLocalCatalog(org.getId(), serviceSpecification );
+ }
+
+
+ } else {
+ Characteristic partyCharacteristicItem = org.findPartyCharacteristic("EXTERNAL_TMFAPI_STATUS");
+ if ( partyCharacteristicItem == null ) {
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName( "EXTERNAL_TMFAPI_STATUS" );
+ partyCharacteristicItem.setValueType( "TEXT" );
+ partyCharacteristicItem.setValue( new Any(""));
+ org.addPartyCharacteristicItem(partyCharacteristicItem);
+
+ }
+
+ partyCharacteristicItem.setValue( new Any("NOT_CONFIGURED"));
+ partnerOrganizationServicesManager.updateOrganizationInCatalog(org.getId(), org);
+ }
+
+
+
+
+ }
+
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrder.java b/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrder.java
new file mode 100644
index 0000000000000000000000000000000000000000..38c31de114ede847228b314383fbdfa415d51373
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrder.java
@@ -0,0 +1,91 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class FlowOneServiceOrder {
+
+ @JsonProperty("id")
+ private String id = null;
+
+
+ @JsonProperty("state")
+ private String state;
+
+
+ @JsonProperty("orderItem")
+ private ServiceOrderItem orderItem ;
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @return the state
+ */
+ public String getState() {
+ return state;
+ }
+
+
+ /**
+ * @param state the state to set
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+
+
+ /**
+ * @return the orderItem
+ */
+ public ServiceOrderItem getOrderItem() {
+ return orderItem;
+ }
+
+
+ /**
+ * @param orderItem the orderItem to set
+ */
+ public void setOrderItem(ServiceOrderItem orderItem) {
+ this.orderItem = orderItem;
+ }
+
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrderCreate.java b/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrderCreate.java
new file mode 100644
index 0000000000000000000000000000000000000000..881c18709eb5b81c450f6528db221c5a1f11c141
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrderCreate.java
@@ -0,0 +1,50 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.so641.model.ServiceOrderCreate;
+
+public class FlowOneServiceOrderCreate extends ServiceOrderCreate{
+
+
+ public FlowOneServiceOrderCreate(ServiceOrderCreate servOrderCreate) {
+ this.setDescription( servOrderCreate.getDescription());
+ this.setCategory( servOrderCreate.getCategory());
+ this.setOrderItem( servOrderCreate.getOrderItem() );
+ this.getOrderItem().get(0).setUuid("1");
+ this.getOrderItem().get(0).setBaseType(null);
+ this.setRequestedCompletionDate( servOrderCreate.getRequestedCompletionDate());
+ this.setRequestedStartDate( servOrderCreate.getRequestedStartDate());
+ this.setRelatedParty(servOrderCreate.getRelatedParty());
+ this.setNote( servOrderCreate.getNote());
+ this.getNote().get(0).setBaseType(null);
+ this.getOrderItem().get(0).state(null);
+ this.getOrderItem().get(0).getService().setBaseType(null);
+ this.getOrderItem().get(0).getService().getServiceSpecification().setBaseType(null);
+ for (Characteristic c : this.getOrderItem().get(0).getService().getServiceCharacteristic()) {
+ c.setBaseType(null);
+ c.setValueType("string");
+ }
+
+ }
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrderUpdate.java b/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrderUpdate.java
new file mode 100644
index 0000000000000000000000000000000000000000..501a7c1998d2eabe8891cabfb153252c5e592eba
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/FlowOneServiceOrderUpdate.java
@@ -0,0 +1,50 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+
+public class FlowOneServiceOrderUpdate extends ServiceOrderUpdate{
+
+
+ public FlowOneServiceOrderUpdate(ServiceOrderUpdate servOrderUpd) {
+ this.setDescription( servOrderUpd.getDescription());
+ this.setCategory( servOrderUpd.getCategory());
+ this.setOrderItem( servOrderUpd.getOrderItem() );
+ this.getOrderItem().get(0).setUuid("1");
+ this.getOrderItem().get(0).setBaseType(null);
+ this.setRequestedCompletionDate( servOrderUpd.getRequestedCompletionDate());
+ this.setRequestedStartDate( servOrderUpd.getRequestedStartDate());
+ this.setRelatedParty(servOrderUpd.getRelatedParty());
+ this.setNote( servOrderUpd.getNote());
+ this.getNote().get(0).setBaseType(null);
+ this.getOrderItem().get(0).state(null);
+ this.getOrderItem().get(0).getService().setBaseType(null);
+ this.getOrderItem().get(0).getService().getServiceSpecification().setBaseType(null);
+ for (Characteristic c : this.getOrderItem().get(0).getService().getServiceCharacteristic()) {
+ c.setBaseType(null);
+ c.setValueType("string");
+ }
+
+ }
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/GenericClient.java b/src/main/java/org/etsi/osl/osom/partnerservices/GenericClient.java
new file mode 100644
index 0000000000000000000000000000000000000000..5cf2042cad001b40b649f48fabe9f44213bd1eea
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/GenericClient.java
@@ -0,0 +1,399 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
+
+import javax.net.ssl.SSLException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.client.reactive.ClientHttpConnector;
+import org.springframework.http.client.reactive.ReactorClientHttpConnector;
+import org.springframework.security.oauth2.client.AuthorizedClientServiceOAuth2AuthorizedClientManager;
+import org.springframework.security.oauth2.client.InMemoryOAuth2AuthorizedClientService;
+import org.springframework.security.oauth2.client.OAuth2AuthorizationContext;
+import org.springframework.security.oauth2.client.OAuth2AuthorizeRequest;
+import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager;
+import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProvider;
+import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder;
+import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService;
+import org.springframework.security.oauth2.client.registration.ClientRegistration;
+import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
+import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository;
+import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
+import org.springframework.security.oauth2.core.AuthorizationGrantType;
+import org.springframework.util.StringUtils;
+import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
+import org.springframework.web.reactive.function.client.ExchangeStrategies;
+import org.springframework.web.reactive.function.client.WebClient;
+
+import io.netty.channel.ChannelOption;
+import io.netty.handler.ssl.SslContext;
+import io.netty.handler.ssl.SslContextBuilder;
+import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
+import io.netty.handler.timeout.ReadTimeoutHandler;
+import io.netty.handler.timeout.WriteTimeoutHandler;
+import jakarta.servlet.http.HttpServletRequest;
+import reactor.core.publisher.Mono;
+import reactor.netty.http.client.HttpClient;
+import reactor.netty.tcp.TcpClient;
+
+//@Configuration
+/**
+ * @author ctranoris
+ *
+ * Since we need multiple clients to be created, we don;t use spring configuration, but they are created on demand
+ * We implement here a Servlet integration
+ * see: https://github.com/spring-projects/spring-security/blob/master/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-client.adoc#oauth2Client-client-creds-grant
+ */
+public class GenericClient {
+
+ private static final transient Log log = LogFactory.getLog(GenericClient.class.getName());
+ private String username;
+ private String password;
+
+
+ private String baseUrl;
+ private String oauth2TokenURI;
+ private String webClientRegistrationId;
+ private String oauth2ClientId;
+ private String oauth2ClientSecret;
+ private String[] oauth2Scopes;
+ private AuthorizationGrantType authorizationGrantType;
+
+ /**
+ * Note: the constructor might change to support the instantiation of multiple clientRegistrations
+ *
+ * @param clientRegistrationId
+ * @param oauth2ClientId
+ * @param oauth2ClientSecret
+ * @param oauth2Scopes
+ * @param oauth2TokenURI
+ * @param username
+ * @param password
+ * @param baseUrl
+ */
+ public GenericClient(
+ String clientRegistrationId,
+ String oauth2ClientId,
+ String oauth2ClientSecret,
+ String[] oauth2Scopes,
+ String oauth2TokenURI,
+ String username,
+ String password,
+ String baseUrl) {
+ super();
+
+ this.webClientRegistrationId = clientRegistrationId;
+
+ this.oauth2ClientId = oauth2ClientId;
+ this.oauth2ClientSecret = oauth2ClientSecret;
+ this.oauth2Scopes = oauth2Scopes;
+ this.oauth2TokenURI = oauth2TokenURI;
+
+ this.username = username;
+ this.password = password;
+ this.baseUrl = baseUrl;
+
+
+ this.authorizationGrantType = AuthorizationGrantType.PASSWORD;
+ }
+
+ public WebClient createWebClient() throws SSLException{
+
+ if ( oauth2ClientId != null ) {
+
+ InMemoryClientRegistrationRepository clientRegistrations = (InMemoryClientRegistrationRepository) this.clientRegistrations() ;
+ OAuth2AuthorizedClientService clientService = new InMemoryOAuth2AuthorizedClientService(clientRegistrations);
+ OAuth2AuthorizedClientManager authorizedClientManager = this.authorizedClientManager(clientRegistrations, clientService);
+
+
+ ServletOAuth2AuthorizedClientExchangeFilterFunction servletOAuth2AuthorizedClientExchangeFilterFunction =
+ this.servletOAuth2AuthorizedClientExchangeFilterFunction(
+ clientRegistrations,
+ authorizedClientManager);
+
+ ClientHttpConnector clientHttpConnector = this.clientHttpConnector() ;
+
+ return webClient(servletOAuth2AuthorizedClientExchangeFilterFunction, clientHttpConnector);
+
+ }else {
+
+ ClientHttpConnector clientHttpConnector = this.clientHttpConnector() ;
+ return webClient( null, clientHttpConnector);
+ }
+ }
+
+
+ private WebClient webClient(
+ ServletOAuth2AuthorizedClientExchangeFilterFunction servletOAuth2AuthorizedClientExchangeFilterFunction,
+ ClientHttpConnector clientHttpConnector) {
+
+ if ( servletOAuth2AuthorizedClientExchangeFilterFunction != null ) {
+ return WebClient.builder()
+ .exchangeStrategies( getExchangeStrategies() )
+ .baseUrl( this.baseUrl )
+ .clientConnector(clientHttpConnector)
+ .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
+ .defaultHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
+ .apply(servletOAuth2AuthorizedClientExchangeFilterFunction.oauth2Configuration())
+ .filter(logRequest())
+ .filter(logResponse())
+ .build();
+ }else
+ return WebClient.builder()
+ .exchangeStrategies( getExchangeStrategies() )
+ .baseUrl( this.baseUrl )
+ .clientConnector(clientHttpConnector)
+ .filter(logRequest())
+ .filter(logResponse())
+ .build();
+ }
+
+ private ExchangeStrategies getExchangeStrategies() {
+
+ ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
+ .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1)).build(); //spring.codec.max-in-memory-size=-1 ?? if use autoconfiguration
+ return exchangeStrategies;
+ }
+
+
+ private ExchangeFilterFunction logRequest() {
+ return (clientRequest, next) -> {
+ log.debug("Request: " + clientRequest.method() + ", " + clientRequest.url());
+ clientRequest.headers()
+ .forEach((name, values) -> values.forEach(value -> log.debug("{" + name + "}={" + value + "}")));
+
+ return next.exchange(clientRequest);
+ };
+ }
+
+ private ExchangeFilterFunction logResponse() {
+ return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> {
+ log.debug("Response: " + clientResponse.statusCode());
+ clientResponse.headers().asHttpHeaders()
+ .forEach((name, values) -> values.forEach(value -> log.debug("{" + name + "}={" + value + "}")));
+ return Mono.just(clientResponse);
+ });
+ }
+
+ //@Bean
+ public ClientRegistrationRepository clientRegistrations() {
+
+ log.info("WebClientConfiguration.clientRegistrations()");
+
+ ClientRegistration clientRegistration;
+
+ if ( oauth2ClientId != null) {
+ clientRegistration = ClientRegistration
+ .withRegistrationId( webClientRegistrationId ) //"authOpensliceProvider"
+ .clientId( oauth2ClientId ) //"osapiWebClientId"
+ .clientSecret( oauth2ClientSecret ) //"secret"
+ .scope( oauth2Scopes ) //"admin"
+ .authorizationGrantType( authorizationGrantType) //AuthorizationGrantType.PASSWORD
+ .tokenUri( oauth2TokenURI )//"http://portal.openslice.io/osapi-oauth-server/oauth/token"
+ .build();
+
+ } else {
+ clientRegistration = ClientRegistration
+ .withRegistrationId( webClientRegistrationId ) //"authOpensliceProvider"
+ .authorizationGrantType( authorizationGrantType) //AuthorizationGrantType.PASSWORD
+ .build();
+ }
+
+
+ return new InMemoryClientRegistrationRepository(clientRegistration);
+ }
+
+ //@Bean
+ public ServletOAuth2AuthorizedClientExchangeFilterFunction servletOAuth2AuthorizedClientExchangeFilterFunction(
+ ClientRegistrationRepository clientRegistrations,
+
+ OAuth2AuthorizedClientManager authorizedClientManager) {
+
+ ServletOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServletOAuth2AuthorizedClientExchangeFilterFunction(
+ authorizedClientManager);
+
+ // oauth.setDefaultOAuth2AuthorizedClient(true);
+ //oauth.setDefaultClientRegistrationId("authOpensliceProvider");
+ oauth.setDefaultClientRegistrationId( this.webClientRegistrationId );
+
+ // oauth.setAccessTokenExpiresSkew(Duration.ofSeconds(30));
+
+ return oauth;
+ }
+
+ //@Bean
+ public ClientHttpConnector clientHttpConnector() throws SSLException {
+
+ log.info("WebClientConfiguration.clientHttpConnector()");
+
+ SslContext sslContext = SslContextBuilder
+ .forClient()
+ .trustManager()
+ .trustManager(InsecureTrustManagerFactory.INSTANCE)
+ .build();
+
+ TcpClient tcpClient = TcpClient.create()
+ //.wiretap(true) //logging on reactor.netty.tcp.TcpClient level to DEBUG
+ .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 30000)
+ .doOnConnected(connection -> connection.addHandlerLast
+ (new ReadTimeoutHandler(30)).addHandlerLast(new WriteTimeoutHandler(30))
+ );
+
+ return new ReactorClientHttpConnector(
+ HttpClient
+ .from(tcpClient)
+ .wiretap(true)//To enable it, you must set the logger reactor.netty.http.client.HttpClient level to DEBUG
+ .secure( sslContextSpec -> sslContextSpec.sslContext(sslContext) )
+ );
+ }
+
+ //@Bean
+ public OAuth2AuthorizedClientManager authorizedClientManager(
+ ClientRegistrationRepository clientRegistrationRepository,
+ OAuth2AuthorizedClientService clientService) {
+
+ OAuth2AuthorizedClientProvider authorizedClientProvider = OAuth2AuthorizedClientProviderBuilder.builder()
+ // .clientCredentials()
+ .password().refreshToken().build();
+
+ AuthorizedClientServiceOAuth2AuthorizedClientManager authorizedClientManager =
+ new AuthorizedClientServiceOAuth2AuthorizedClientManager(
+ clientRegistrationRepository, clientService);
+ authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider);
+ authorizedClientManager.setContextAttributesMapper(contextAttributesMapper());
+ return authorizedClientManager;
+ }
+
+ private Function> contextAttributesMapper() {
+ return authorizeRequest -> {
+ Map contextAttributes = Collections.emptyMap();
+ HttpServletRequest servletRequest = authorizeRequest.getAttribute(HttpServletRequest.class.getName());
+ // String username = "admin";//
+ // servletRequest.getParameter(OAuth2ParameterNames.USERNAME);
+ // String password =
+ // "openslice";//servletRequest.getParameter(OAuth2ParameterNames.PASSWORD);
+ if (StringUtils.hasText(username) && StringUtils.hasText(password)) {
+ contextAttributes = new HashMap<>();
+
+ // `PasswordOAuth2AuthorizedClientProvider` requires both attributes
+ contextAttributes.put(OAuth2AuthorizationContext.USERNAME_ATTRIBUTE_NAME, this.username);
+ contextAttributes.put(OAuth2AuthorizationContext.PASSWORD_ATTRIBUTE_NAME, this.password);
+ }
+ return contextAttributes;
+ };
+ }
+
+ /**
+ * @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 oauth2TokenURI
+ */
+ public String getOauth2TokenURI() {
+ return oauth2TokenURI;
+ }
+
+ /**
+ * @param oauth2TokenURI the oauth2TokenURI to set
+ */
+ public void setOauth2TokenURI(String oauth2TokenURI) {
+ this.oauth2TokenURI = oauth2TokenURI;
+ }
+
+ /**
+ * @return the webClientRegistrationId
+ */
+ public String getWebClientRegistrationId() {
+ return webClientRegistrationId;
+ }
+
+ /**
+ * @param webClientRegistrationId the webClientRegistrationId to set
+ */
+ public void setWebClientRegistrationId(String webClientRegistrationId) {
+ this.webClientRegistrationId = webClientRegistrationId;
+ }
+
+ /**
+ * @return the oauth2ClientId
+ */
+ public String getOauth2ClientId() {
+ return oauth2ClientId;
+ }
+
+ /**
+ * @param oauth2ClientId the oauth2ClientId to set
+ */
+ public void setOauth2ClientId(String oauth2ClientId) {
+ this.oauth2ClientId = oauth2ClientId;
+ }
+
+ /**
+ * @return the oauth2ClientSecret
+ */
+ public String getOauth2ClientSecret() {
+ return oauth2ClientSecret;
+ }
+
+ /**
+ * @param oauth2ClientSecret the oauth2ClientSecret to set
+ */
+ public void setOauth2ClientSecret(String oauth2ClientSecret) {
+ this.oauth2ClientSecret = oauth2ClientSecret;
+ }
+
+
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/PartnerOrganizationServicesManager.java b/src/main/java/org/etsi/osl/osom/partnerservices/PartnerOrganizationServicesManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..71132f9186218667a094ad3189df906fd3f32548
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/PartnerOrganizationServicesManager.java
@@ -0,0 +1,1061 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import java.io.IOException;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.net.ssl.SSLException;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpStatusCode;
+import org.springframework.stereotype.Service;
+import org.springframework.web.reactive.function.client.WebClient;
+
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.pm632.model.Characteristic;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.scm633.model.ServiceCandidate;
+import org.etsi.osl.tmf.scm633.model.ServiceCategory;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderCreate;
+import org.etsi.osl.tmf.so641.model.ServiceOrderStateType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+import jakarta.validation.constraints.NotNull;
+import reactor.core.publisher.Mono;
+
+/**
+ * @author ctranoris
+ *
+ */
+@Service
+public class PartnerOrganizationServicesManager {
+
+ private static final transient Log logger = LogFactory.getLog(PartnerOrganizationServicesManager.class.getName());
+
+ @Autowired
+ private ProducerTemplate template;
+
+ @Value("${CATALOG_GET_EXTERNAL_SERVICE_PARTNERS}")
+ private String CATALOG_GET_EXTERNAL_SERVICE_PARTNERS = "";
+
+
+ @Value("${CATALOG_UPD_EXTERNAL_SERVICESPEC}")
+ private String CATALOG_UPD_EXTERNAL_SERVICESPEC = "";
+
+
+ @Value("${CATALOG_UPDATE_PARTNER_ORGANIZATION}")
+ private String CATALOG_UPDATE_PARTNER_ORGANIZATION = "";
+
+ Map webclients = new HashMap<>();
+
+ public List retrievePartners() {
+ logger.info("will retrieve Service Providers from catalog ");
+ try {
+ Map map = new HashMap<>();
+ Object response = template.requestBodyAndHeaders(CATALOG_GET_EXTERNAL_SERVICE_PARTNERS, "", map);
+
+ if (!(response instanceof String)) {
+ logger.error("List object is wrong.");
+ return null;
+ }
+
+ Class> clazz = (Class) List.class;
+ List organizations = mapJsonToObjectList(new Organization(), (String) response,
+ Organization.class);
+ logger.info("retrieveSPs response is: " + response);
+ return organizations;
+
+ } catch (Exception e) {
+ logger.error("Cannot retrieve Listof Service Providers from catalog. " + e.toString());
+ }
+ return null;
+ }
+
+ protected static List mapJsonToObjectList(T typeDef, String json, Class clazz) throws Exception {
+ List list;
+ ObjectMapper mapper = new ObjectMapper();
+ System.out.println(json);
+ TypeFactory t = TypeFactory.defaultInstance();
+ list = mapper.readValue(json, t.constructCollectionType(ArrayList.class, clazz));
+
+// System.out.println(list);
+// System.out.println(list.get(0).getClass());
+ return list;
+ }
+
+ public List fetchServiceSpecs(Organization org) {
+
+ Characteristic ctype = org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID");
+ if ( ctype !=null ) {
+ if (ctype.getValue().getValue().contains("flowone")) {
+ return fetchServiceSpecsFlowOne(org); //break here
+ }
+ }
+
+
+
+ logger.info("Will fetchServiceSpecs of organization: " + org.getName() + ", id: " + org.getId());
+
+ WebClient webclient = this.getOrganizationWebClient(org);
+
+ List totalSpecsList = new ArrayList<>();
+
+ /**
+ * First fetch any from catalog URLs, only if there is a URL
+ */
+ try
+ {
+ String url = "/tmf-api/serviceCatalogManagement/v4/serviceSpecification";
+ if ( ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATALOG_URLS") != null) &&
+ (org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATALOG_URLS").getValue() != null) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATALOG_URLS").getValue().getValue().equals("") )) {
+
+ url = org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATALOG_URLS").getValue().getValue();
+ logger.info("Will fetchServiceSpecs of organization: " + org.getName() + " from: " + url );
+
+ if ( webclient!=null ) {
+ List specsList = webclient.get()
+ .uri( url )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx error");
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT 4xx ERROR");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx error");
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT 5xx ERROR");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference>() {})
+ .block();
+
+ totalSpecsList.addAll(specsList);
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ this.updateOrgzStatus(org, "WEBCLIENT is null");
+ }
+ }
+ }catch (Exception e) {
+ logger.error("fetchServiceSpecs error on web client request");
+ this.updateOrgzStatus(org, "WEBCLIENT fetchServiceSpecs error ");
+ this.invalidateOrganizationWebClient(org);
+ return new ArrayList<>();
+
+ }
+
+
+
+ //EXTERNAL_TMFAPI_SERVICE_CATEGORY_URLS
+ /**
+ * fetch any from category URLs
+ */
+ try
+ {
+
+ String urls = "/tmf-api/serviceCatalogManagement/v4/serviceCategory";
+
+ if ( ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATEGORY_URLS") != null) &&
+ (org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATEGORY_URLS").getValue() != null) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATEGORY_URLS").getValue().getValue().equals("") )) {
+ urls = org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATEGORY_URLS").getValue().getValue();
+ }
+
+ String[] urlToFetch = urls.split(",");
+
+
+
+ if ( webclient!=null ) {
+ for (String url : urlToFetch) {
+ logger.info("Will fetchServiceCandidates of organization: " + org.getName() + " from: " + url );
+
+
+ ServiceCategory sc = webclient.get()
+ .uri( url )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx error");
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT 4xx ERROR");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx error");
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT 5xx ERROR");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference< ServiceCategory>() {})
+ .block();
+
+
+ //prepei me neo fetch sot service candidate na parw to spec
+
+ for (ServiceCandidate serviceCandidateRef : sc.getServiceCandidateObj() ) {
+ url = url.split("serviceCategory")[0];
+ String urlCandidate = url + "serviceCandidate/" + serviceCandidateRef.getId();
+ ServiceCandidate scand = webclient.get()
+ .uri( urlCandidate )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx error");
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT 4xx ERROR");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx error");
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT 5xx ERROR");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference< ServiceCandidate>() {})
+ .block();
+
+
+ //we only care for the id, so we add this in this fake spec
+
+ if ( (scand!=null) && ( scand.getServiceSpecificationObj() != null) ) {
+ totalSpecsList.add( scand.getServiceSpecificationObj() );
+ }
+
+ }
+
+
+
+ }
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ this.updateOrgzStatus(org, "WEBCLIENT is null");
+ }
+
+ }catch (Exception e) {
+ logger.error("fetchServiceSpecs error on web client request");
+ this.updateOrgzStatus(org, "WEBCLIENT fetchServiceSpecs error ");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ return new ArrayList<>();
+ }
+
+
+ /**
+ * will fetch each spec details from API
+ */
+
+
+ List fullSpecsResult = new ArrayList<>();
+ String urlfullspec = "/tmf-api/serviceCatalogManagement/v4/serviceSpecification";
+
+ if ( ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_SPEC") != null) &&
+ (org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_SPEC").getValue() != null) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_SPEC").getValue().getValue().equals(""))) {
+ urlfullspec = org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_SPEC").getValue().getValue();
+ }
+
+ for (ServiceSpecification specsrc : totalSpecsList) {
+ if ( specsrc.getId()!=null ) {
+ ServiceSpecification fullspec = webclient.get()
+ .uri( urlfullspec + "/" + specsrc.getId() )
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx error");
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT ServiceSpecification 4xx ERROR " + specsrc.getId() );
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx error");
+
+ webclients.remove( org.getId(), webclient );
+ this.updateOrgzStatus(org, "WEBCLIENT ServiceSpecification 5xx ERROR " + specsrc.getId() );
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference< ServiceSpecification>() {})
+ .block();
+ logger.info("Will add from " + org.getName() + " serviceSpecification name: " + fullspec.getName() + ", id: " + fullspec.getId());
+ fullSpecsResult.add( fullspec );
+ }
+ }
+
+
+ this.updateOrgzStatus(org, "FULLSPECS SUCCESS");
+
+ return fullSpecsResult;
+ }
+
+
+ private List fetchServiceSpecsFlowOne(Organization org) {
+ logger.info("Will fetchServiceSpecsFlowOne of organization: " + org.getName() + ", id: " + org.getId());
+
+ WebClient webclient = this.getOrganizationWebClient(org);
+ List specs = new ArrayList<>();
+
+ try
+ {
+
+ if ( webclient!=null ) {
+
+ /**
+ * first fetch only id since it is a Long
+ */
+ List aspecsIDs = webclient.get()
+ .uri( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_CATALOG_URLS").getValue().getValue() )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ this.updateOrgzStatus(org, "WEBCLIENT 4xx ERROR");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ this.updateOrgzStatus(org, "WEBCLIENT 5xx ERROR");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference< List>() {})
+ .block();
+
+
+ /**
+ * then fetch the sp
+ */
+ for (SimpleIDSpec aspecID : aspecsIDs) {
+ //SimpleIDSpec aspecId = toJsonObj(aspecsID, SimpleIDSpec.class);
+ String s = toJsonString( aspecID );
+ ServiceSpecification aspec = aspecID;// toJsonObj(s, ServiceSpecification.class);
+ aspec.setUuid( ""+ aspecID.getIntAsString() );
+
+
+ for (ServiceSpecCharacteristic characts : aspec.getServiceSpecCharacteristic()) {
+ characts.setConfigurable(true); //this is a hack for FlowOne
+ characts.setValueType("TEXT");
+// for (ServiceSpecCharacteristicValue cval : characts.getServiceSpecCharacteristicValue()) {
+// cval.value
+// }
+ }
+
+ logger.info("Will add FlowOne serviceSpecification name: " + aspec.getName() + ", id: " + aspec.getId());
+ specs.add(aspec);
+ }
+
+
+
+
+ } else {
+ this.updateOrgzStatus(org, "fetchServiceSpecsFlowone WebClient is null. Cannot be created");
+ logger.error("WebClient is null. Cannot be created.");
+ }
+
+ }catch (Exception e) {
+ logger.error("fetchServiceSpecsFlowone error on web client request");
+ webclients.put(org.getId(), null);//to reset the webclient to retrieve a new one when there is a new try\
+ this.updateOrgzStatus(org, "fetchServiceSpecsFlowone error on web client request");
+ e.printStackTrace();
+ }
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+
+ return specs;
+ }
+
+
+ private void invalidateOrganizationWebClient(Organization org) {
+ if (webclients.get(org.getId()) != null) {
+ webclients.remove( org.getId() );
+ }
+
+ }
+
+ private WebClient getOrganizationWebClient(Organization org) {
+
+// if (webclients.get(org.getId()) != null) {
+// return webclients.get( org.getId() );
+// } else {
+
+
+ try {
+ String[] scopes = new String[0];
+ String clientRegId = "";
+ String aOAUTH2CLIENTID = "";
+ String aOAUTHSECRET="";
+ String aTOKEURI="";
+ String aUSERNAME="";
+ String aPASSWORD="";
+ String aBASEURL="";
+
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2SCOPES")!=null ) {
+ scopes = org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2SCOPES").getValue().getValue().split(";");
+ }
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID") !=null ) {
+ clientRegId = org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID").getValue().getValue();
+ }
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2CLIENTID") !=null ) {
+ aOAUTH2CLIENTID = org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2CLIENTID").getValue().getValue();
+ }
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2CLIENTSECRET") !=null ) {
+ aOAUTHSECRET = org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2CLIENTSECRET").getValue().getValue();
+ }
+
+
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2TOKENURI") !=null ) {
+ aTOKEURI = org.findPartyCharacteristic("EXTERNAL_TMFAPI_OAUTH2TOKENURI").getValue().getValue();
+ }
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_USERNAME") !=null ) {
+ aUSERNAME = org.findPartyCharacteristic("EXTERNAL_TMFAPI_USERNAME").getValue().getValue();
+ }
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_PASSWORD") !=null ) {
+ aPASSWORD = org.findPartyCharacteristic("EXTERNAL_TMFAPI_PASSWORD").getValue().getValue();
+ }
+ if ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_BASEURL") !=null ) {
+ aBASEURL = org.findPartyCharacteristic("EXTERNAL_TMFAPI_BASEURL").getValue().getValue();
+ }
+
+
+
+ GenericClient oac = new GenericClient(
+
+ clientRegId,
+ aOAUTH2CLIENTID,
+ aOAUTHSECRET,
+ scopes,
+ aTOKEURI,
+ aUSERNAME,
+ aPASSWORD,
+ aBASEURL );
+
+ WebClient webClient;
+ webClient = oac.createWebClient();
+ webclients.put( org.getId() , webClient);
+ return webClient;
+ } catch (SSLException e) {
+
+ e.printStackTrace();
+ this.updateOrgzStatus(org, "WEBCLIENT ERROR SSLException");
+ }
+
+// }
+ return null;
+ }
+
+ private void updateOrgzStatus(Organization org, String status) {
+ Characteristic partyCharacteristicItem = org.findPartyCharacteristic("EXTERNAL_TMFAPI_STATUS");
+ if ( partyCharacteristicItem == null ) {
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName( "EXTERNAL_TMFAPI_STATUS" );
+ partyCharacteristicItem.setValueType( "TEXT" );
+ partyCharacteristicItem.setValue( new Any(""));
+ org.addPartyCharacteristicItem(partyCharacteristicItem);
+ }
+
+ partyCharacteristicItem.setValue( new Any( OffsetDateTime.now(ZoneOffset.UTC) + ": " + status ));
+ this.updateOrganizationInCatalog(org.getId(), org);
+
+ }
+
+ public ServiceSpecification updateSpecInLocalCatalog(String orgid, ServiceSpecification serviceSpecification) {
+ logger.info("Will UpdateSpecInLocalCatalog serviceSpecification name: " + serviceSpecification.getName() + ", id: " + serviceSpecification.getId());
+
+ try {
+ Map map = new HashMap<>();
+ map.put("servicespecid", serviceSpecification.getId() );
+ map.put("orgid", orgid );
+ Object response = template.requestBodyAndHeaders( CATALOG_UPD_EXTERNAL_SERVICESPEC, toJsonString( serviceSpecification ), map);
+
+ if ( !(response instanceof String)) {
+ logger.error("Service Spec object is wrong.");
+ }
+
+ ServiceSpecification serviceSpecResp = toJsonObj( (String)response, ServiceSpecification.class);
+ //logger.debug("createService response is: " + response);
+ return serviceSpecResp;
+
+
+ }catch (Exception e) {
+ logger.error("Cannot update Service Spec : " + serviceSpecification.getId() + ": " + e.toString());
+ }
+ return null;
+
+ }
+
+
+ public Organization updateOrganizationInCatalog(String orgid, Organization orgz) {
+ logger.info("Will updateOrganizationCatalog orgz name: " + orgz.getName() + ", id: " + orgid);
+
+ try {
+ Map map = new HashMap<>();
+ map.put("orgid", orgid );
+ Object response = template.requestBodyAndHeaders( CATALOG_UPDATE_PARTNER_ORGANIZATION, toJsonString( orgz ), map);
+
+ if ( !(response instanceof String)) {
+ logger.error("Organization object is wrong.");
+ }
+
+ Organization orgzresp = toJsonObj( (String)response, Organization.class);
+ //logger.debug("createService response is: " + response);
+ return orgzresp;
+
+
+ }catch (Exception e) {
+ logger.error("Cannot update Organization : " + orgid + ": " + e.toString());
+ }
+ return null;
+
+ }
+
+
+ static T toJsonObj(String content, Class valueType) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.readValue(content, valueType);
+ }
+
+ static String toJsonString(Object object) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.writeValueAsString(object);
+ }
+
+ public ServiceOrder makeExternalServiceOrder(ServiceOrderCreate servOrder, Organization org, String remoteServiceSpecID) {
+
+ Characteristic ctype = org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID");
+ if ( ctype !=null ) {
+ if (ctype.getValue().getValue().contains("flowone")) {
+ return makeExternalServiceOrderFlowOne(servOrder, org, remoteServiceSpecID); //break here
+ }
+ }
+
+ logger.info("Will makeExternalServiceOrder to organization: " + org.getName() + ", id: " + org.getId());
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+
+
+ //EXTERNAL_TMFAPI_SERVICE_ORDER_URLS
+ String url = "/tmf-api/serviceOrdering/v4/serviceOrder";
+
+ if ( ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS") != null) &&
+ (org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue() != null) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue().getValue().equals("") )) {
+ url = org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue().getValue();
+ }
+
+ ServiceOrder sorder = new ServiceOrder();
+
+ if ( webclient!=null ) {
+
+ try {
+ sorder = webclient.post()
+ .uri(url)
+ //.header("Authorization", "Basic " + encodedClientData)
+ .bodyValue( servOrder )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ }
+
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ }
+
+
+
+ return sorder;
+ }
+
+ private ServiceOrder makeExternalServiceOrderFlowOne( ServiceOrderCreate servOrderCreate, Organization org, String remoteServiceSpecID ) {
+ logger.info("Will makeExternalServiceOrderFlowOne to organization: " + org.getName() + ", id: " + org.getId());
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+ FlowOneServiceOrderCreate servOrder = new FlowOneServiceOrderCreate( servOrderCreate );
+
+
+
+ String abody = "";
+ try {
+ abody = toJsonString( servOrder );
+ logger.debug( "ServiceOrderCreate = " + abody );
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+
+ ServiceOrder sorder = new ServiceOrder();
+
+
+ if ( webclient!=null ) {
+
+ try {
+ sorder = webclient.post()
+ .uri( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue().getValue() )
+ //.header("Authorization", "Basic " + encodedClientData)
+ .bodyValue( abody )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ }
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ }
+
+
+
+ return sorder;
+ }
+
+ public ServiceOrder retrieveServiceOrder(Organization org, String externalServiceOrderId) {
+
+ Characteristic ctype = org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID");
+ if ( ctype !=null ) {
+ if (ctype.getValue().getValue().contains("flowone")) {
+ return retrieveServiceOrderFlowOne( org, externalServiceOrderId); //break here
+ }
+ }
+
+
+ logger.info("Will retrieveServiceOrder from organization: " + org.getName() + ", id: " + org.getId());
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+
+
+ ServiceOrder sorder = new ServiceOrder();
+ if ( webclient!=null ) {
+ try {
+
+ sorder = webclient.get()
+ .uri("/tmf-api/serviceOrdering/v4/serviceOrder/{id}", externalServiceOrderId)
+ //.header("Authorization", "Basic " + encodedClientData)
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ }
+
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+
+ this.invalidateOrganizationWebClient(org);
+ }
+
+
+
+ return sorder;
+ }
+
+ /**
+ * @param org
+ * @param externalServiceOrderId
+ * @return
+ */
+ private ServiceOrder retrieveServiceOrderFlowOne(Organization org, String externalServiceOrderId) {
+ logger.info("Will retrieveServiceOrderFlowOne from organization: " + org.getName() + ", id: " + org.getId());
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+
+
+ ServiceOrder sorder = new ServiceOrder();
+ if ( webclient!=null ) {
+
+ try {
+ String sorderStr = webclient.get()
+ .uri(org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue().getValue() + "/" + externalServiceOrderId)
+ //.header("Authorization", "Basic " + encodedClientData)
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+
+
+
+ //sorderStr = sorderStr.replace("\"note\":{", "\"note\":{\"id\":\"1\",");
+ FlowOneServiceOrder flowsorder = toJsonObj(sorderStr, FlowOneServiceOrder.class);
+ sorder.setUuid( flowsorder.getId() );
+ if ( flowsorder.getState() != null) {
+ sorder.setState( ServiceOrderStateType.fromValue( flowsorder.getState().toUpperCase() ));
+ } else {
+ sorder.setState( ServiceOrderStateType.INPROGRESS );
+ logger.error("FlowOneServiceOrder state is NULL");
+ }
+ sorder.addOrderItemItem(flowsorder.getOrderItem());
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ }
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ }
+
+
+
+ return sorder;
+ }
+
+
+ public ServiceOrder updateExternalServiceOrder(String serviceId, ServiceOrderUpdate servOrder, Organization org) {
+
+ Characteristic ctype = org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID");
+ if ( ctype !=null ) {
+ if (ctype.getValue().getValue().contains("flowone")) {
+ return updateExternalServiceOrderFlowOne(serviceId, servOrder, org); //break here
+ }
+ }
+
+ logger.info("Will updateExternalServiceOrder to organization: " + org.getName() + ", id: " + org.getId());
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+
+
+ //EXTERNAL_TMFAPI_SERVICE_ORDER_URLS
+ String url = "/tmf-api/serviceOrdering/v4/serviceOrder/" + serviceId;
+
+ if ( ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS") != null) &&
+ (org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue() != null) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue().getValue().equals("") )) {
+ url = org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue().getValue();
+ }
+
+ ServiceOrder sorder = new ServiceOrder();
+
+ if ( webclient!=null ) {
+
+ try {
+ sorder = webclient.patch()
+ .uri(url)
+ //.header("Authorization", "Basic " + encodedClientData)
+ .bodyValue( servOrder )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ }
+
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ }
+
+
+
+ return sorder;
+ }
+
+
+ private ServiceOrder updateExternalServiceOrderFlowOne( String serviceId, ServiceOrderUpdate servOrderUpd, Organization org ) {
+ logger.info("Will makeExternalServiceOrderFlowOne to organization: " + org.getName() + ", id: " + org.getId());
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+ FlowOneServiceOrderUpdate servOrder = new FlowOneServiceOrderUpdate( servOrderUpd );
+
+
+
+ String abody = "";
+ try {
+ abody = toJsonString( servOrder );
+ logger.debug( "updateExternalServiceOrderFlowOne = " + abody );
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+
+ ServiceOrder sorder = new ServiceOrder();
+
+
+ if ( webclient!=null ) {
+
+ try {
+ sorder = webclient.patch()
+ .uri( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS").getValue().getValue()+"/"+serviceId )
+ //.header("Authorization", "Basic " + encodedClientData)
+ .bodyValue( abody )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ }
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ this.invalidateOrganizationWebClient(org);
+ }
+
+
+
+ return sorder;
+ }
+
+
+
+
+
+ public org.etsi.osl.tmf.sim638.model.Service retrieveServiceFromInventory(@NotNull Organization org, @NotNull String externalServiceId) {
+
+ logger.info("Will retrieveServiceFromInventory from organization: " + org.getName() + ", id: " + org.getId());
+
+ for (int i = 0; i < 5; i++) { //try 5 times if something is wrong
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+
+
+ org.etsi.osl.tmf.sim638.model.Service srvc = new org.etsi.osl.tmf.sim638.model.Service();
+ if ( webclient!=null ) {
+
+ try {
+ srvc = webclient.get()
+ .uri("/tmf-api/serviceInventory/v4/service/{id}", externalServiceId)
+ //.header("Authorization", "Basic " + encodedClientData)
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+
+
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ this.invalidateOrganizationWebClient(org);
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ return srvc;
+ }
+
+ return null;
+
+ }
+
+ public org.etsi.osl.tmf.sim638.model.Service updateExternalService(String externalPartnerServiceId, ServiceUpdate servUpdate, Organization org) {
+ Characteristic ctype = org.findPartyCharacteristic("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID");
+
+
+ logger.info("Will updateExternalServiceOrder to organization: " + org.getName() + ", id: " + org.getId());
+
+ /**
+ * will create or fetch existing web client for this organization
+ */
+ WebClient webclient = this.getOrganizationWebClient(org);
+
+
+ //EXTERNAL_TMFAPI_SERVICE_ORDER_URLS
+ String url = "/tmf-api/serviceInventory/v4/service/" + externalPartnerServiceId;
+
+ if ( ( org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_INVENTORY_URLS") != null) &&
+ (org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_INVENTORY_URLS").getValue() != null) &&
+ (!org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_INVENTORY_URLS").getValue().getValue().equals("") )) {
+ url = org.findPartyCharacteristic("EXTERNAL_TMFAPI_SERVICE_INVENTORY_URLS").getValue().getValue();
+ }
+
+ org.etsi.osl.tmf.sim638.model.Service serv = new org.etsi.osl.tmf.sim638.model.Service();
+
+ if ( webclient!=null ) {
+
+ try {
+ serv = webclient.patch()
+ .uri(url)
+ //.header("Authorization", "Basic " + encodedClientData)
+ .bodyValue( servUpdate )
+ //.attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+ .retrieve()
+ .onStatus(HttpStatusCode::is4xxClientError, response -> {
+ logger.error("4xx eror");
+ return Mono.error(new RuntimeException("4xx"));
+ })
+ .onStatus(HttpStatusCode::is5xxServerError, response -> {
+ logger.error("5xx eror");
+ return Mono.error(new RuntimeException("5xx"));
+ })
+ .bodyToMono( new ParameterizedTypeReference() {})
+ .block();
+ }catch (Exception e) {
+ logger.error(" error on web client request");
+ this.invalidateOrganizationWebClient(org);
+ e.printStackTrace();
+ }
+
+
+
+ } else {
+ logger.error("WebClient is null. Cannot be created.");
+ }
+
+
+
+ return serv;
+ }
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/SimpleIDSpec.java b/src/main/java/org/etsi/osl/osom/partnerservices/SimpleIDSpec.java
new file mode 100644
index 0000000000000000000000000000000000000000..395c1c708249fe723ddd8f2e37f3e6f1f3392c94
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/SimpleIDSpec.java
@@ -0,0 +1,63 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom.partnerservices;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+
+
+
+/**
+ * @author ctranoris
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class SimpleIDSpec extends ServiceSpecification{
+
+
+ @JsonProperty("id")
+ protected long id;
+
+ /**
+ * @return the id
+ */
+// @Override
+// public long getId() {
+// return id;
+// }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @JsonIgnore
+ public String getIntAsString() {
+ return id + "";
+ }
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/partnerservices/SyncPartnerServiceInventory.java b/src/main/java/org/etsi/osl/osom/partnerservices/SyncPartnerServiceInventory.java
new file mode 100644
index 0000000000000000000000000000000000000000..e150fb78863717bfb634ad5bf1a3014f99e0464a
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/partnerservices/SyncPartnerServiceInventory.java
@@ -0,0 +1,77 @@
+package org.etsi.osl.osom.partnerservices;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.prm669.model.RelatedParty;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "SyncPartnerServiceInventory") // bean name
+public class SyncPartnerServiceInventory implements JavaDelegate {
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+ private static final transient Log logger = LogFactory.getLog( SyncPartnerServiceInventory.class.getName() );
+ @Override
+ public void execute(DelegateExecution execution) {
+ logger.info("===================== SyncPartnerServiceInventory ====================");
+
+ //fetch from our service Inventory, Service of external Partners
+ List itemsToBeProcessed = serviceOrderManager.retrieveActiveServiceOfExternalPartners();
+ if ( itemsToBeProcessed != null ) {
+ for (String serviceID : itemsToBeProcessed) {
+ logger.info("Will sync local service with id: " + serviceID + " with partner service inventory");
+
+ //fetch local service
+ Service aService = serviceOrderManager.retrieveService(serviceID);
+ Characteristic externalPartnerServiceId = aService.getServiceCharacteristicByName( "externalPartnerServiceId" );
+
+ Organization org = null;
+
+ if ( aService.getRelatedParty().stream().findFirst().isPresent() ) {
+ RelatedParty rp = aService.getRelatedParty().stream().findFirst().get();
+ if ( ( rp != null ) && ( rp.getRole().equals("ORGANIZATION") ) ) {
+ String orgId = rp.getId();
+ org = serviceOrderManager.getExternalPartnerOrganization(orgId);
+ }
+ }
+
+
+ if ( ( externalPartnerServiceId != null ) && ( org != null )) {
+ String extServiceId = externalPartnerServiceId.getValue().getValue();
+
+
+ Service remotePartnerService = partnerOrganizationServicesManager.retrieveServiceFromInventory( org, extServiceId);
+
+ ServiceUpdate supd = new ServiceUpdate();
+ for (Characteristic c : remotePartnerService.getServiceCharacteristic()) {
+ c.setUuid(null);
+ if ( !c.getName().equals("EXEC_ACTION")) {
+ supd.addServiceCharacteristicItem(c);
+ }
+ }
+ supd.setState( remotePartnerService.getState() );
+ serviceOrderManager.updateService(serviceID, supd , false);
+
+
+
+ }
+
+ }
+ }
+
+ }
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/AutomaticallyHandleAction.java b/src/main/java/org/etsi/osl/osom/serviceactions/AutomaticallyHandleAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..de5215ea46efe2abc094867227930121259ca5f1
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/AutomaticallyHandleAction.java
@@ -0,0 +1,66 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "AutomaticallyHandleAction") //bean name
+public class AutomaticallyHandleAction implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( AutomaticallyHandleAction.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("AutomaticallyHandleAction:" + execution.getVariableNames().toString() );
+
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ ServiceActionQueueItem item;
+ Service aService;
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+
+ ServiceUpdate supd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action AutomaticallyHandleAction. Action: " + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem( n );
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/CRPatchTask.java b/src/main/java/org/etsi/osl/osom/serviceactions/CRPatchTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..e0eb2510636e38f2bde524f3310ccfe38aeec792
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/CRPatchTask.java
@@ -0,0 +1,111 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.AlarmsService;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.ScaleDescriptor;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.EValueType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "CRPatchTask") // bean name
+public class CRPatchTask implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(CRPatchTask.class.getName());
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ AlarmsService alarmsService;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.debug("CRPatchTask:" + execution.getVariableNames().toString());
+
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceActionQueueItem item;
+ Service aService;
+ Service originalService;
+ try {
+ item = mapper.readValue(execution.getVariable("serviceActionItem").toString(),
+ ServiceActionQueueItem.class);
+ aService = mapper.readValue(execution.getVariable("Service").toString(), Service.class);
+ // extract the original service from the Item
+
+ originalService = mapper.readValue(item.getOriginalServiceInJSON(), Service.class);;
+ } catch (JsonProcessingException e1) {
+ e1.printStackTrace();
+ return;
+ }
+
+
+
+ List changeCharacteristics = new ArrayList<>();
+ // send to mano client here: only the modified action!
+ // identify here the characteristics that changed
+ if (aService.getServiceCharacteristic() != null) {
+ for (Characteristic srcChar : aService.getServiceCharacteristic()) {
+
+ if (originalService.getServiceCharacteristicByName(srcChar.getName()) != null) {
+
+ Characteristic origChar =
+ originalService.getServiceCharacteristicByName(srcChar.getName());
+ if ((origChar != null) && (origChar.getValue() != null)
+ && (origChar.getValue().getValue() != null)) {
+ if (!origChar.getValue().getValue().equals(srcChar.getValue().getValue())) {
+ changeCharacteristics.add(srcChar);
+ }
+ }
+ }
+ }
+ }
+
+
+
+ Note n = new Note();
+ n.setText("Service Action CRPatchTask does nothing for now. Action: " + item.getAction() + ". ");
+ n.setAuthor(compname);
+ n.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString());
+
+
+
+ ServiceUpdate supd = new ServiceUpdate();
+
+
+ supd.addNoteItem(n);
+ serviceOrderManager.deleteServiceActionQueueItem(item);
+ serviceOrderManager.updateService(aService.getId(), supd, false);
+
+ logger.debug("CRPatchTask:" + n.getText());
+
+
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/CRTerminateTask.java b/src/main/java/org/etsi/osl/osom/serviceactions/CRTerminateTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..2efd2d9d5ccd913863260eb5e302bc2bf5720e28
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/CRTerminateTask.java
@@ -0,0 +1,146 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ResourceRef;
+import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "CRTerminateTask") //bean name
+public class CRTerminateTask implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( CRTerminateTask.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("CRTerminateTask:" + execution.getVariableNames().toString() );
+
+ Service aService = null;
+ if (execution.getVariable("Service")!=null) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+ logger.info("Will terminate Service with id:" + aService.getId() );
+
+
+
+ try {
+ if (aService.getServiceCharacteristicByName( "_CR_SPEC" ) != null ){
+ String crspec = aService.getServiceCharacteristicByName( "_CR_SPEC" ).getValue().getValue();
+
+ if (crspec != null) {
+ logger.info("Will terminate CR related to service. We need to fetchthe underlying resource" );
+
+ //we need to get the equivalent resource spec. since ServiceSpec is an RFS
+
+ try {
+ for (ResourceRef resRef : aService.getSupportingResource()) {
+ Map map = new HashMap<>();
+ map.put("currentContextCluster",getServiceCharacteristic(aService, "currentContextCluster") );
+ map.put("clusterMasterURL",getServiceCharacteristic(aService, "clusterMasterURL") );
+ map.put("org.etsi.osl.serviceId", aService.getId() );
+ map.put("org.etsi.osl.resourceId", resRef.getId() );
+ map.put("org.etsi.osl.serviceOrderId", aService.getServiceOrder().stream().findFirst().get().getId() );
+ map.put("org.etsi.osl.namespace", aService.getServiceOrder().stream().findFirst().get().getId() );
+ map.put("org.etsi.osl.statusCheckFieldName", getServiceCharacteristic(aService, "_CR_CHECK_FIELD") );
+ map.put("org.etsi.osl.statusCheckValueStandby", getServiceCharacteristic(aService, "_CR_CHECKVAL_STANDBY") );
+ map.put("org.etsi.osl.statusCheckValueAlarm", getServiceCharacteristic(aService, "_CR_CHECKVAL_ALARM") );
+ map.put("org.etsi.osl.statusCheckValueAvailable", getServiceCharacteristic(aService, "_CR_CHECKVAL_AVAILABLE") );
+ map.put("org.etsi.osl.statusCheckValueReserved", getServiceCharacteristic(aService, "_CR_CHECKVAL_RESERVED") );
+ map.put("org.etsi.osl.statusCheckValueUnknown", getServiceCharacteristic(aService, "_CR_CHECKVAL_UNKNOWN") );
+ map.put("org.etsi.osl.statusCheckValueSuspended", getServiceCharacteristic(aService, "_CR_CHECKVAL_SUSPENDED") );
+
+ serviceOrderManager.cridgeDeletionRequest( map, crspec);
+
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+
+
+
+ }
+
+
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ }
+
+
+
+ try {
+ ServiceActionQueueItem item;
+
+ ObjectMapper mapper = new ObjectMapper();
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+
+ ServiceUpdate supd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action CRTerminateTask. Action: " + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem( n );
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+
+ private Object getServiceCharacteristic(Service aService, String val) {
+ if (aService.getServiceCharacteristicByName( val ) !=null ) {
+ return aService.getServiceCharacteristicByName( val ).getValue().getValue();
+ }
+ return "";
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/ExternalProviderServiceAction.java b/src/main/java/org/etsi/osl/osom/serviceactions/ExternalProviderServiceAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..fd0616c5ef2e19265f7dfaef93ca5e0ecf2ac699
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/ExternalProviderServiceAction.java
@@ -0,0 +1,170 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.etsi.osl.osom.partnerservices.PartnerOrganizationServicesManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueAction;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderActionType;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.so641.model.ServiceOrderUpdate;
+
+@Component(value = "ExternalProviderServiceAction") //bean name
+public class ExternalProviderServiceAction implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ExternalProviderServiceAction.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+
+ @Value("${THIS_PARTNER_NAME}")
+ private String THIS_PARTNER_NAME = "";
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ExternalProviderServiceAction:" + execution.getVariableNames().toString() );
+ String externalServiceOrderId = (String) execution.getVariable("externalServiceOrderId") ;
+ String externalPartnerServiceId = (String) execution.getVariable("externalPartnerServiceId") ;
+ String organizationId = (String) execution.getVariable("organizationId") ;
+
+
+
+ ServiceActionQueueItem item;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+
+
+ logger.debug("Checking Order Status from partner with organizationId=" + organizationId + " of Order externalServiceOrderId= " + externalServiceOrderId );
+
+
+
+ Organization orgz = serviceOrderManager.getExternalPartnerOrganization( organizationId );
+ if ( orgz ==null ) {
+
+ logger.debug("Organization is NULL");
+ }
+
+ Note noteItem = new Note();
+ noteItem.setText("Service Action ExternalProviderServiceAction from " + THIS_PARTNER_NAME + " action " + item.getAction().toString());
+ noteItem.author(compname);
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+
+ if ( externalPartnerServiceId != null ) {
+ //do nothing if the service contains the field externalPartnerServiceId
+ } else {
+ ServiceOrderUpdate servOrder = new ServiceOrderUpdate();
+
+ servOrder.addNoteItem(noteItem);
+ ServiceOrder externalSOrder = partnerOrganizationServicesManager.retrieveServiceOrder( orgz, externalServiceOrderId );
+ if (externalSOrder != null ) {
+ logger.info("External partner organization order state:" + externalSOrder.getState() );
+ for (ServiceOrderItem ext_soi : externalSOrder.getOrderItem()) {
+
+ if ( item.getAction().equals( ServiceActionQueueAction.DEACTIVATE ) || item.getAction().equals( ServiceActionQueueAction.TERMINATE ) ) {
+ ext_soi.getService().setState( ServiceStateType.TERMINATED );
+ }
+ ext_soi.action(ServiceOrderActionType.MODIFY);
+
+ servOrder.addOrderItemItem(ext_soi);
+ }
+ }
+
+ partnerOrganizationServicesManager.updateExternalServiceOrder(externalServiceOrderId, servOrder, orgz);
+
+ }
+
+
+ Service aService = null;
+ if (execution.getVariable("Service")!=null) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ ServiceUpdate localServiceUpd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action ExternalProviderServiceAction. Action: " + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ localServiceUpd.addNoteItem( n );
+
+
+
+ if ( externalPartnerServiceId != null ) {
+ ServiceUpdate externServUpdate = new ServiceUpdate();
+ externServUpdate.addNoteItem(noteItem);
+ for (Characteristic serviceChar : aService.getServiceCharacteristic() ) {
+ serviceChar.setUuid( null );
+ if ( serviceChar.getName().equals("externalPartnerServiceId") || serviceChar.getName().equals("externalServiceOrderId")) {
+ ;//do nothing. Do not copy these two
+ }else {
+ externServUpdate.addServiceCharacteristicItem(serviceChar);
+ }
+ }
+ Service responseService = partnerOrganizationServicesManager.updateExternalService(externalPartnerServiceId, externServUpdate, orgz);
+
+ //reflect characteristics and status here from response
+ localServiceUpd.setState(responseService.getState() );
+ for (Characteristic serviceChar : responseService.getServiceCharacteristic() ) {
+ serviceChar.setUuid( null );
+ localServiceUpd.addServiceCharacteristicItem(serviceChar);
+ }
+ }
+
+
+
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+ serviceOrderManager.updateService( aService.getId() , localServiceUpd, false);
+
+ //need to clear any alarm if action was EXEC_ACTION
+
+ } catch (JsonMappingException e1) {
+ e1.printStackTrace();
+ } catch (JsonProcessingException e1) {
+ e1.printStackTrace();
+ }
+
+
+
+ }
+
+
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/FetchServiceQueueItems.java b/src/main/java/org/etsi/osl/osom/serviceactions/FetchServiceQueueItems.java
new file mode 100644
index 0000000000000000000000000000000000000000..9ce3cb3dbe84331726d36d04ebd1f10ca6b2e1b5
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/FetchServiceQueueItems.java
@@ -0,0 +1,58 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+
+@Component(value = "fetchServiceQueueItems") // bean name
+public class FetchServiceQueueItems implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(FetchServiceQueueItems.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ public void execute(DelegateExecution execution) {
+ logger.info("===================== FetchServiceQueueItems by Service Inventory Repository ===================== ");
+
+
+ List itemsToBeProcessed = serviceOrderManager.retrieveServiceQueueItems();
+ if ( itemsToBeProcessed!= null ) {
+ for (ServiceActionQueueItem serviceActionQueueItem : itemsToBeProcessed) {
+ logger.debug("FetchServiceQueueItems serviceActionQueueItem getServiceRefId = " + serviceActionQueueItem.getServiceRefId());
+
+ }
+ }
+
+
+ List itemListAsString = new ArrayList<>();
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ if ( itemsToBeProcessed!=null) {
+ for (ServiceActionQueueItem item : itemsToBeProcessed) {
+ String o = mapper.writeValueAsString(item);
+ itemListAsString.add(o);
+ }
+ }
+
+ execution.setVariable("serviceActionsToBeProcessed", itemListAsString);
+
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/HandleManuallyAction.java b/src/main/java/org/etsi/osl/osom/serviceactions/HandleManuallyAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..7e8137577e9ab8c577479cf5003291525d47f9ed
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/HandleManuallyAction.java
@@ -0,0 +1,68 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "HandleManuallyAction") //bean name
+public class HandleManuallyAction implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( HandleManuallyAction.class.getName() );
+
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("HandleManuallyAction:" + execution.getVariableNames().toString() );
+ logger.info("Action will be logged and deleted" );
+ Service aService = null;
+ ServiceActionQueueItem item;
+ if (execution.getVariable("Service")!=null) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ ServiceUpdate supd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action HandleManuallyAction." + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem( n );
+
+
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+ } catch (JsonMappingException e1) {
+ e1.printStackTrace();
+ } catch (JsonProcessingException e1) {
+ e1.printStackTrace();
+ }
+
+
+
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/NFVODAY2config.java b/src/main/java/org/etsi/osl/osom/serviceactions/NFVODAY2config.java
new file mode 100644
index 0000000000000000000000000000000000000000..feee282977ed95bf745bf34b0ee76b574f9e9d88
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/NFVODAY2config.java
@@ -0,0 +1,314 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.AlarmsService;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.ScaleDescriptor;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.EValueType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "NFVODAY2config") //bean name
+public class NFVODAY2config implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( NFVODAY2config.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ AlarmsService alarmsService;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.debug("NFVODAY2config:" + execution.getVariableNames().toString() );
+
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceActionQueueItem item;
+ Service aService;
+ Service originalService;
+ try {
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+ //extract the original service from the Item
+
+ originalService = mapper.readValue( item.getOriginalServiceInJSON() , Service.class);;
+ } catch (JsonProcessingException e1) {
+ e1.printStackTrace();
+ return;
+ }
+
+
+
+ List changeCharacteristics = new ArrayList<>();
+ //send to mano client here: only the modified action!
+ //identify here the characteristics that changed
+ if ( aService.getServiceCharacteristic()!=null ) {
+ for (Characteristic srcChar : aService.getServiceCharacteristic()) {
+
+ if ( originalService.getServiceCharacteristicByName( srcChar.getName() )!= null ) {
+
+ Characteristic origChar = originalService.getServiceCharacteristicByName( srcChar.getName() );
+ if ( ( origChar !=null ) && ( origChar.getValue() !=null ) && ( origChar.getValue().getValue() !=null )) {
+ if ( !origChar.getValue().getValue().equals(srcChar.getValue().getValue()) ) {
+ changeCharacteristics.add( srcChar );
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+ Note n = new Note();
+ n.setText("Service Action NFVODAY2config. Action: " + item.getAction() +". " );
+ n.setAuthor( compname);
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+
+
+ String nsInstanceId = "";
+ if ( aService.getServiceCharacteristicByName( "InstanceId" )!=null) {
+ nsInstanceId= aService.getServiceCharacteristicByName( "InstanceId" ).getValue().getValue() ;
+ } else {
+ logger.error("NFVODAY2config: InstanceId is NULL." );
+
+ }
+
+
+ ServiceUpdate supd = new ServiceUpdate();
+
+ String ncTxt = "";
+ for (Characteristic characteristic : changeCharacteristics) {
+ ncTxt += characteristic.getName() + ", ";
+
+
+ if ( ncTxt.toUpperCase().contains( "PRIMITIVE::" ) ) {
+ if ( (characteristic != null ) && (characteristic.getValueType() != null ) && characteristic.getValueType().equals("ARRAY") ) {
+
+ NSActionRequestPayload nsp = new NSActionRequestPayload();
+ nsp.setNsInstanceId(nsInstanceId);
+
+
+ String characteristicValue = characteristic.getValue().getValue();
+ List vals = new ArrayList<>();
+ try {
+ vals = mapper.readValue( characteristicValue, new TypeReference>() {});
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ n.setText( n.getText() + characteristicValue + "\nERROR\n" + e.getOriginalMessage() );
+
+ }
+
+ logger.debug("NFVODAY2config: characteristicValue = " +characteristicValue );
+ for ( Any actionValue : vals) {
+ if ( actionValue.getAlias().equals("primitive") ) {
+ nsp.setPrimitive( actionValue.getValue() );
+ } else if ( actionValue.getAlias().equals("member_vnf_index") ) {
+ nsp.setVnf_member_index( actionValue.getValue() );
+ } else if ( actionValue.getAlias().equals("vdu_id") ) {
+ nsp.setVdu_id( actionValue.getValue() );
+ } else if ( actionValue.getAlias().equals("vdu_count_index") ) {
+ nsp.setVdu_count_index( actionValue.getValue() );
+ } else {
+
+ nsp.getPrimitive_params().put( actionValue.getAlias() , actionValue.getValue());
+ }
+ }
+
+ if ( nsp.getPrimitive() != null ) {
+ /**
+ * {
+ "nsInstanceId": "8a3db62a-eb0e-48d9-be9b-548f7f034512",
+ "member_vnf_index": "?",
+ "primitive": "?",
+ "primitive_params": {
+ "?": "?"
+ }
+ }
+ */
+
+ String payload="NO_PAYLOAD";
+ try {
+ payload = mapper.writeValueAsString(nsp);
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ logger.debug("NFVODAY2config NSActionRequestPayload= " + payload );
+ String actionresult = serviceOrderManager.nfvoDay2Action(nsp);
+ if ( actionresult.contains("ACCEPTED") ) {
+ n.setText( n.getText() + "ACCEPTED" );
+
+ } else {
+ n.setText( n.getText() + " " + actionresult );
+ }
+ }
+
+
+
+ }
+ } else if ( ncTxt.toUpperCase().contains( "EXEC_ACTION" ) ) {
+ String characteristicValue = characteristic.getValue().getValue();
+ Map vals = new HashMap<>();
+ try {
+ vals = mapper.readValue( characteristicValue, new TypeReference< Map>() {});
+ } catch (JsonProcessingException e1) {
+ e1.printStackTrace();
+ n.setText( n.getText() + characteristicValue + "\nERROR\n" + e1.getOriginalMessage() );
+ }
+ logger.debug("NFVODAY2config: EXEC_ACTION characteristicValue = " +characteristicValue );
+ //first add to a new item the acknowledge
+ Characteristic characteristicAck = new Characteristic();
+ characteristicAck.setName("EXEC_ACTION_LAST_ACK");
+ characteristicAck.setValueType( EValueType.TEXT.getValue() );
+
+ if ( vals.get("ACTION_NAME") != null) {
+ if ( vals.get("ACTION_NAME").equalsIgnoreCase("scaleServiceEqually") ) {
+
+ ScaleDescriptor aScaleDescriptor = new ScaleDescriptor();
+ aScaleDescriptor.setNsInstanceId(nsInstanceId);
+ aScaleDescriptor.setMemberVnfIndex( vals.get("Member_vnf_index") );
+ aScaleDescriptor.setScalingGroupDescriptor(vals.get("Scaling_group_descriptor"));
+ aScaleDescriptor.setScaleVnfType( "SCALE_OUT" );
+
+ String actionresult = serviceOrderManager.nfvoScaleDescriptorAction( aScaleDescriptor );
+ logger.debug("NFVODAY2config: actionresult = " +actionresult );
+
+ if ( actionresult != null ) {
+ if ( actionresult.contains("202") ) {
+ n.setText( n.getText() + "ACCEPTED. Values=" + vals.toString());
+ characteristicAck.setValueType( characteristicAck.getValueType() );
+ Any value = new Any();
+ value.setValue( characteristicValue );
+ characteristicAck.setValue( value );
+ } else {
+ n.setText( n.getText() + " " + actionresult );
+ characteristicAck.setValueType( "TEXT" );
+ Any value = new Any();
+ value.setValue( "ERROR" );
+ characteristicAck.setValue( value );
+ }
+
+ } else {
+
+ n.setText( n.getText() + " ERROR ON NFVODAY2config" );
+ characteristicAck.setValueType( "TEXT" );
+ Any value = new Any();
+ value.setValue( "ERROR" );
+ characteristicAck.setValue( value );
+ }
+
+ } else if ( vals.get("ACTION_NAME").equalsIgnoreCase("execDay2") ) {
+ NSActionRequestPayload nsp = new NSActionRequestPayload();
+ nsp.setNsInstanceId(nsInstanceId);
+ try {
+ for (String valkey : vals.keySet() ) {
+ if ( valkey.equals("primitive") ) {
+ nsp.setPrimitive( vals.get("primitive") ); // e.g. fsetup
+ } else if ( valkey.equals("member_vnf_index") ) {
+ nsp.setVnf_member_index( vals.get("member_vnf_index") ); // e.g. fsetup
+ } else if ( valkey.equals("vdu_id") ) {
+ nsp.setVdu_id( vals.get("vdu_id") ); // e.g. fsetup
+ }else if ( valkey.equals("vdu_count_index") ) {
+ nsp.setVdu_count_index( vals.get("vdu_count_index") ); // e.g. fsetup
+ }else if ( valkey.equals("params") ) {
+ String[] params = vals.get("params").split(";");
+ for (String prm : params) {
+ String[] p = prm.split("=");
+ nsp.getPrimitive_params().put( p[0] , p[1] );
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ if ( nsp.getPrimitive() != null ) {
+ /**
+ * {
+ "nsInstanceId": "8a3db62a-eb0e-48d9-be9b-548f7f034512",
+ "member_vnf_index": "?",
+ "primitive": "?",
+ "primitive_params": {
+ "?": "?"
+ }
+ }
+ */
+
+ String payload="NO_PAYLOAD";
+ try {
+ payload = mapper.writeValueAsString(nsp);
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ logger.debug("ACTION_NAME execDay2 NFVODAY2config NSActionRequestPayload= " + payload );
+ String actionresult = serviceOrderManager.nfvoDay2Action(nsp);
+ if ( actionresult.contains("ACCEPTED") ) {
+ n.setText( n.getText() + "ACCEPTED for ACTION_NAME execDay2" );
+ characteristicAck.setValueType( "TEXT" );
+ Any value = new Any();
+ value.setValue( "ACCEPTED" );
+ characteristicAck.setValue( value );
+
+ } else {
+ n.setText( n.getText() + " " + actionresult );
+ characteristicAck.setValueType( "TEXT" );
+ Any value = new Any();
+ value.setValue( "ERROR" );
+ characteristicAck.setValue( value );
+ }
+ }
+
+
+ }
+
+ }
+
+
+
+ supd.addServiceCharacteristicItem(characteristicAck);
+
+ }
+
+
+ }
+
+
+ supd.addNoteItem( n );
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+ logger.debug("NFVODAY2config:" + n.getText() );
+
+
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/NFVONSTerminateTask.java b/src/main/java/org/etsi/osl/osom/serviceactions/NFVONSTerminateTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..439101f1f0043c3c1d6145be140f4b7a96fc4f13
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/NFVONSTerminateTask.java
@@ -0,0 +1,100 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.Date;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "NFVONSTerminateTask") //bean name
+public class NFVONSTerminateTask implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( NFVONSTerminateTask.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("NFVONSTerminateTask:" + execution.getVariableNames().toString() );
+
+ Service aService = null;
+ if (execution.getVariable("Service")!=null) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+ logger.info("Will terminate Service with id:" + aService.getId() );
+
+
+
+ if (aService.getServiceCharacteristicByName( "DeploymentRequestID" ) != null ){
+ String deploymentRequestID = aService.getServiceCharacteristicByName( "DeploymentRequestID" ).getValue().getValue();
+ logger.info("Will terminate DeploymentRequestID:" + deploymentRequestID );
+ DeploymentDescriptor dd =serviceOrderManager.retrieveNFVODeploymentRequestById( Long.parseLong( deploymentRequestID ) );
+ if ( dd != null ) {
+ dd.setEndDate( new Date() ); // it will terminate it now
+ serviceOrderManager.nfvoDeploymentRequestByNSDid(dd);
+
+ }
+ }
+
+
+ try {
+ ServiceActionQueueItem item;
+
+ ObjectMapper mapper = new ObjectMapper();
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+
+ ServiceUpdate supd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action NFVONSTerminateTask. Action: " + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem( n );
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/NSActionRequestPayload.java b/src/main/java/org/etsi/osl/osom/serviceactions/NSActionRequestPayload.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb58af78aeee9d769f237bcdbb1d693a3ae8577a
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/NSActionRequestPayload.java
@@ -0,0 +1,157 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.sol007nbi.osm
+ * %%
+ * 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.osom.serviceactions;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * @author ichatzis
+ *
+ */
+public class NSActionRequestPayload
+{
+
+ private String nsInstanceId;
+ private String member_vnf_index; // Needed for VNFD mapping NSD.constituent-vnfd.member-vnf-index. If missing a NSD is targeting. Example: "member_vnf_index": "1",
+ private String vdu_id; // Needed if target is a VDU. Maps VNFD.vdu-id
+ private String vdu_count_index; // Needed if the VDU has several replicas (count>1)
+ private String primitive; // Mandatory. Maps [NSD.ns-configuration or VNFD.vnf-configuration or VNFD.vdu.vdu-configuration].config-primitive.name. Example: "primitive": "touch"
+ private String param;
+ private String lcmOperationType; //"lcmOperationType": "action"
+ private String vnf_member_index; // TODO for backward compatibility. To remove in future
+ private String kdu_name;
+ private Integer timeout_ns_action;
+ private Map primitive_params = new LinkedHashMap<>();
+
+ public Map getPrimitive_params() {
+ return primitive_params;
+ }
+
+ @JsonAnySetter
+ public void setPrimitive_params(Map primitive_params) {
+ this.primitive_params = primitive_params;
+ }
+
+ public String getMember_vnf_index() {
+ return member_vnf_index;
+ }
+
+ public void setMember_vnf_index(String member_vnf_index) {
+ this.member_vnf_index = member_vnf_index;
+ }
+
+ public String getVdu_id() {
+ return vdu_id;
+ }
+
+ public void setVdu_id(String vdu_id) {
+ this.vdu_id = vdu_id;
+ }
+
+ public String getVdu_count_index() {
+ return vdu_count_index;
+ }
+
+ public void setVdu_count_index(String vdu_count_index) {
+ this.vdu_count_index = vdu_count_index;
+ }
+
+ public String getPrimitive() {
+ return primitive;
+ }
+
+ public void setPrimitive(String primitive) {
+ this.primitive = primitive;
+ }
+
+ public void setPrimitiveParams(String primitive_name, String primitive_value) {
+ }
+
+ public String getParam() {
+ return param;
+ }
+
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ public String getLcmOperationType() {
+ return lcmOperationType;
+ }
+
+ public void setLcmOperationType(String lcmOperationType) {
+ this.lcmOperationType = lcmOperationType;
+ }
+
+ public String getNsInstanceId() {
+ return nsInstanceId;
+ }
+
+ public void setNsInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
+
+ public String getVnf_member_index() {
+ return vnf_member_index;
+ }
+
+ public void setVnf_member_index(String vnf_member_index) {
+ this.vnf_member_index = vnf_member_index;
+ }
+
+ public String getKdu_name() {
+ return kdu_name;
+ }
+
+ public void setKdu_name(String kdu_name) {
+ this.kdu_name = kdu_name;
+ }
+
+ public Integer getTimeout_ns_action() {
+ return timeout_ns_action;
+ }
+
+ public void setTimeout_ns_action(Integer timeout_ns_action) {
+ this.timeout_ns_action = timeout_ns_action;
+ }
+
+ 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/osom/serviceactions/ServiceActionCheck.java b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActionCheck.java
new file mode 100644
index 0000000000000000000000000000000000000000..68e1ab20f74c6784da45eaf985df596ce506b412
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActionCheck.java
@@ -0,0 +1,179 @@
+package org.etsi.osl.osom.serviceactions;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.UserPartRoleType;
+import org.etsi.osl.tmf.common.model.service.ResourceRef;
+import org.etsi.osl.tmf.common.model.service.ServiceRef;
+import org.etsi.osl.tmf.prm669.model.RelatedParty;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueAction;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+
+@Component(value = "serviceActionCheck") //bean name
+public class ServiceActionCheck implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ServiceActionCheck.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ServiceActionCheck:" + execution.getVariableNames().toString() );
+
+
+
+ if (execution.getVariable("serviceActionItem")!=null) {
+ logger.debug("Will check status of serviceActionItem of ref:" + execution.getVariable("serviceActionItem") );
+ ObjectMapper mapper = new ObjectMapper();
+
+ ServiceActionQueueItem item;
+ execution.setVariable("saction", "HandleManuallyAction");
+ try {
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+
+
+ Service aService = serviceOrderManager.retrieveService( item.getServiceRefId() );
+ if ( aService == null ) {
+ logger.error("aService is NULL!" );
+ execution.setVariable("saction", "HandleManuallyAction");
+ return;
+ } else {
+ if ( aService.getSupportingService()!=null) {
+ for (ServiceRef aSupportingService : aService.getSupportingService() ) {
+ logger.debug("aSupportingService:" + aSupportingService.getName() );
+ }
+ }
+
+ if ( aService.getSupportingResource()!=null) {
+ for (ResourceRef aSupportingResource : aService.getSupportingResource() ) {
+ logger.debug("aSupportingResource:" + aSupportingResource.getName() );
+ }
+
+ }
+ }
+
+
+
+ if ( item.getAction().equals( ServiceActionQueueAction.EVALUATE_STATE_CHANGE_TOACTIVE ) ) {
+ execution.setVariable("saction", "HandleActiveStateChanged");
+ } else if ( item.getAction().equals( ServiceActionQueueAction.EVALUATE_STATE_CHANGE_TOINACTIVE ) ) {
+ execution.setVariable("saction", "HandleInactiveStateChanged");
+ } else if ( item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED ) || item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED_MANODAY2 ) ) {
+
+ execution.setVariable("saction", "HandleEvaluateService");// default
+
+ if ( (aService.getServiceCharacteristicByName( "externalServiceOrderId" ) != null )){
+ execution.setVariable("saction", "ExternalProviderServiceAction");
+ execution.setVariable("externalServiceOrderId", aService.getServiceCharacteristicByName( "externalServiceOrderId" ).getValue().getValue() );
+
+ if ( (aService.getServiceCharacteristicByName( "externalPartnerServiceId" ) != null )){
+ execution.setVariable("externalPartnerServiceId", aService.getServiceCharacteristicByName( "externalPartnerServiceId" ).getValue().getValue() );
+ }
+
+ RelatedParty rpOrg = null;
+ if ( aService.getRelatedParty() != null ) {
+ for (RelatedParty rp : aService.getRelatedParty()) {
+ if ( rp.getRole().equals( UserPartRoleType.ORGANIZATION.getValue() )) {
+ rpOrg =rp;
+ break;
+ }
+ }
+ }
+ if ( rpOrg == null) {
+ logger.error("Cannot retrieve partner organization, switch to HandleManuallyAction" );
+ execution.setVariable("saction", "HandleManuallyAction");
+ } else {
+ execution.setVariable("organizationId", rpOrg.getId() );
+
+ }
+ }else if ( aService.getCategory().equals( "ResourceFacingService") ) {
+
+ if (aService.getServiceCharacteristicByName( "NSDID" ) != null && item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED_MANODAY2 ) ){
+ execution.setVariable("saction", "NFVODAY2config");
+
+ } else if (aService.getServiceCharacteristicByName("_CR_SPEC") != null) {
+ execution.setVariable("saction", "CRPatch");
+ }
+ else {
+ execution.setVariable("saction", "AutomaticallyHandleAction");
+ }
+
+ }
+
+
+ } else if ( !item.getAction().equals( ServiceActionQueueAction.NONE ) ) {
+
+ if ( aService.getCategory().equals( "CustomerFacingService") ) {
+ execution.setVariable("saction", "AutomaticallyHandleAction");
+
+ } else if ( aService.getCategory().equals( "ResourceFacingService") ) {
+
+ if (aService.getServiceCharacteristicByName( "NSDID" ) != null ){
+ if ( item.getAction().equals( ServiceActionQueueAction.DEACTIVATE ) || item.getAction().equals( ServiceActionQueueAction.TERMINATE ) ) {
+ execution.setVariable("saction", "NFVONSTerminate");
+ } else if ( item.getAction().equals( ServiceActionQueueAction.MODIFY ) && item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED_MANODAY2 )) {
+ execution.setVariable("saction", "NFVODAY2config");
+ } else {
+ execution.setVariable("saction", "HandleManuallyAction");
+ }
+ } else if (aService.getServiceCharacteristicByName("_CR_SPEC") != null) {
+ if (item.getAction().equals(ServiceActionQueueAction.DEACTIVATE) || item.getAction().equals(ServiceActionQueueAction.TERMINATE)) {
+ execution.setVariable("saction", "CRTerminate");
+ } else if (item.getAction().equals(ServiceActionQueueAction.MODIFY) ) {
+ execution.setVariable("saction", "CRPatch");
+ } else {
+ execution.setVariable("saction", "AutomaticallyHandleAction");
+ }
+
+ }
+ else {
+ execution.setVariable("saction", "AutomaticallyHandleAction");
+ }
+
+ }
+
+
+
+ } else {
+ execution.setVariable("saction", "HandleManuallyAction");
+ }
+
+
+
+
+ try {
+ String srv = mapper.writeValueAsString( aService );
+ execution.setVariable("Service", srv);
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActionComplete.java b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActionComplete.java
new file mode 100644
index 0000000000000000000000000000000000000000..1ba2d6d699e9be8b72c7b7f0e737aa8d0791665d
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActionComplete.java
@@ -0,0 +1,26 @@
+package org.etsi.osl.osom.serviceactions;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component(value = "ServiceActionComplete") //bean name
+public class ServiceActionComplete implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ServiceActionComplete.class.getName() );
+
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ServiceActionComplete:" + execution.getVariableNames().toString() );
+
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActivationAction.java b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActivationAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..dc2fa17a7992c036ea9d9cc9450429341b622dce
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceActivationAction.java
@@ -0,0 +1,121 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.etsi.osl.osom.lcm.LCMRulesExecutorVariables;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.lcm.model.ELCMRulePhase;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@Component(value = "ServiceActivationAction") //bean name
+public class ServiceActivationAction implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ServiceActivationAction.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ServiceActivationAction:" + execution.getVariableNames().toString() );
+
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ ServiceActionQueueItem item;
+ Service aService;
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+
+ ServiceUpdate supd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action ServiceActivationAction. Action: " + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem( n );
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+
+
+
+
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );//fetch the equivalent spec;
+ ServiceOrder sor = null;
+ ServiceOrderItem soi = null;
+
+ if ( aService.getServiceOrder().size() >0 ) {
+ sor = serviceOrderManager.retrieveServiceOrder( aService.getServiceOrder().stream().findFirst().get().getId() ) ;
+ if ( sor.getOrderItem().size()>0) {
+ soi = sor.getOrderItem().stream().findFirst().get();
+ }
+ }
+
+
+ if ( spec!= null ) {
+ //execute any LCM rules "AFTER_ACTIVATION" phase for the SPEC;
+ LCMRulesExecutorVariables vars = new LCMRulesExecutorVariables(spec, sor, soi, null, supd, aService, serviceOrderManager);
+
+ logger.debug("===============BEFORE lcmRulesController.execPhas AFTER_ACTIVATION for spec:" + spec.getName() + " =============================");
+ vars = lcmRulesController.execPhase( ELCMRulePhase.AFTER_ACTIVATION, vars );
+
+ //logger.debug("vars= " + vars );
+ logger.debug("===============AFTER lcmRulesController.execPhas =============================");
+
+ Note noteItem = new Note();
+
+ if ( vars.getCompileDiagnosticErrors().size()>0 ) {
+ String msg = "LCM Rule execution error by ServiceActivationAction. ";
+ for (String tmsg : vars.getCompileDiagnosticErrors()) {
+ msg = msg + "\n"+ tmsg;
+ }
+ noteItem.setText( msg );
+ } else {
+ String msg = "LCM AFTER_ACTIVATION Rules executed. ";
+ noteItem.setText( msg );
+
+ }
+ noteItem.setAuthor( compname );
+ noteItem.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem(noteItem);
+ }
+
+
+
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/ServiceEvaluateAction.java b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceEvaluateAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..8679313e67115ad735eafac05368e351d2f0cf75
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceEvaluateAction.java
@@ -0,0 +1,148 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.etsi.osl.osom.lcm.LCMRulesExecutorVariables;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.lcm.model.ELCMRulePhase;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+import org.etsi.osl.tmf.stm653.model.ServiceTest;
+import org.etsi.osl.tmf.stm653.model.ServiceTestUpdate;
+
+@Component(value = "ServiceEvaluateAction") //bean name
+public class ServiceEvaluateAction implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ServiceEvaluateAction.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ServiceEvaluateAction:" + execution.getVariableNames().toString() );
+
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ ServiceActionQueueItem item;
+ Service aService;
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+
+ ServiceUpdate supd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action ServiceEvaluateAction. Action: " + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem( n );
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+
+
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );//fetch the equivalent spec;
+ ServiceOrder sor = null;
+ ServiceOrderItem soi = null;
+
+ if ( aService.getServiceOrder().size() >0 ) {
+ sor = serviceOrderManager.retrieveServiceOrder( aService.getServiceOrder().stream().findFirst().get().getId() ) ;
+ if ( sor == null ) {
+ logger.error("ServiceOrder is NULL. will return!");
+ return;
+ }
+ if ( sor.getOrderItem().size()>0) {
+ soi = sor.getOrderItem().stream().findFirst().get();
+ }
+ }
+
+
+ if ( spec!= null ) {
+ //execute any LCM rules "SUPERVISION" phase for the SPEC;
+ LCMRulesExecutorVariables vars = new LCMRulesExecutorVariables(spec, sor, soi, null, supd,aService, serviceOrderManager);
+ logger.debug("===============DEBUG lcmRulesController.execPhas SUPERVISION for spec:" + spec.getName() + " =============================");
+
+ Characteristic schart = aService.getServiceCharacteristicByName("long_text");
+ if ( schart!= null ) {
+ String teest = schart.getValue().getValue();
+ logger.debug("schart size = " + teest.length() );
+
+ logger.debug("schart " + teest );
+ logger.debug("======================================================================================================");
+ }
+
+ logger.debug("===============BEFORE lcmRulesController.execPhas SUPERVISION for spec:" + spec.getName() + " =============================");
+ vars = lcmRulesController.execPhase( ELCMRulePhase.SUPERVISION, vars );
+
+ //logger.debug("vars= " + vars );
+ logger.debug("===============AFTER lcmRulesController.execPhas =============================");
+
+ Note noteItem = new Note();
+ if ( vars.getCompileDiagnosticErrors().size()>0 ) {
+ String msg = "LCM Rule execution error by ServiceEvaluateAction. ";
+ for (String tmsg : vars.getCompileDiagnosticErrors()) {
+ msg = msg + "\n"+ tmsg;
+ }
+ noteItem.setText( msg );
+ } else {
+ String msg = "LCM SUPERVISION Rules executed. ";
+ noteItem.setText( msg );
+
+ }
+ noteItem.setAuthor( compname );
+ supd.addNoteItem(noteItem);
+ }
+
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+ //if references ServiceTest we need to update it
+
+ if ( ( aService.getServiceCharacteristicByName( "testSpecRef" ) != null ) && ( aService.getServiceCharacteristicByName( "testInstanceRef" ) != null ) ) {
+ String sTestId = aService.getServiceCharacteristicByName( "testInstanceRef" ).getValue().getValue();
+ ServiceTest serviceTest = serviceOrderManager.retrieveServiceTest(sTestId);
+ ServiceTestUpdate stupd = new ServiceTestUpdate();
+ for (org.etsi.osl.tmf.stm653.model.Characteristic c : serviceTest.getCharacteristic()) {
+ stupd.addCharacteristicItem( c );
+ String newvalue = aService.getServiceCharacteristicByName( c.getName() ).getValue().getValue();
+ c.setValue( new Any(newvalue) ) ;
+ }
+
+ serviceOrderManager.updateServiceTest(sTestId, stupd);
+
+ }
+
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/ServiceInactiveAction.java b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceInactiveAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..1fad4f5237843156f408b6caf512729503f9091a
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/ServiceInactiveAction.java
@@ -0,0 +1,121 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesController;
+import org.etsi.osl.osom.lcm.LCMRulesExecutorVariables;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.Note;
+import org.etsi.osl.tmf.lcm.model.ELCMRulePhase;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceActionQueueItem;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@Component(value = "ServiceInactiveAction") //bean name
+public class ServiceInactiveAction implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog( ServiceInactiveAction.class.getName() );
+
+ @Value("${spring.application.name}")
+ private String compname;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ @Autowired
+ private LCMRulesController lcmRulesController;
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("ServiceInactiveAction:" + execution.getVariableNames().toString() );
+
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ ServiceActionQueueItem item;
+ Service aService;
+ item = mapper.readValue( execution.getVariable("serviceActionItem").toString(), ServiceActionQueueItem.class);
+ aService = mapper.readValue( execution.getVariable("Service").toString(), Service.class);
+
+ if ( aService == null ) {
+ logger.error("Service is NULL. will return!");
+ return;
+ }
+
+ ServiceUpdate supd = new ServiceUpdate();
+ Note n = new Note();
+ n.setText("Service Action ServiceInactiveAction. Action: " + item.getAction() );
+ n.setAuthor( compname );
+ n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() );
+ supd.addNoteItem( n );
+ serviceOrderManager.deleteServiceActionQueueItem( item );
+
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec( aService.getServiceSpecificationRef().getId() );//fetch the equivalent spec;
+ ServiceOrder sor = null;
+ ServiceOrderItem soi = null;
+
+ if ( aService.getServiceOrder().size() >0 ) {
+ sor = serviceOrderManager.retrieveServiceOrder( aService.getServiceOrder().stream().findFirst().get().getId() ) ;
+ if ( sor == null) {
+ logger.error("Service Order NULL. will return!");
+ return;
+
+ }
+ if ( sor.getOrderItem().size()>0) {
+ soi = sor.getOrderItem().stream().findFirst().get();
+ }
+ }
+
+
+ if ( spec!= null ) {
+ //execute any LCM rules "AFTER_DEACTIVATION" phase for the SPEC;
+ LCMRulesExecutorVariables vars = new LCMRulesExecutorVariables(spec, sor, soi, null, supd, aService, serviceOrderManager);
+
+ logger.debug("===============BEFORE lcmRulesController.execPhas AFTER_DEACTIVATION for spec:" + spec.getName() + " =============================");
+ vars = lcmRulesController.execPhase( ELCMRulePhase.AFTER_DEACTIVATION, vars );
+
+ //logger.debug("vars= " + vars );
+ logger.debug("===============AFTER lcmRulesController.execPhas =============================");
+
+ if ( vars.getCompileDiagnosticErrors().size()>0 ) {
+ Note noteItem = new Note();
+ String msg = "LCM Rule execution error by ServiceInactiveAction. ";
+ for (String tmsg : vars.getCompileDiagnosticErrors()) {
+ msg = msg + "\n"+ tmsg;
+ }
+ noteItem.setText( msg );
+ noteItem.setAuthor( compname );
+ supd.addNoteItem(noteItem);
+ }
+ }
+
+
+ serviceOrderManager.updateService( aService.getId() , supd, false);
+
+
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ return;
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+}
diff --git a/src/main/java/org/etsi/osl/osom/serviceactions/fetchAndTerminateScheduledServices.java b/src/main/java/org/etsi/osl/osom/serviceactions/fetchAndTerminateScheduledServices.java
new file mode 100644
index 0000000000000000000000000000000000000000..b28385ba58e90c28dd2d084d891252beda8bf18d
--- /dev/null
+++ b/src/main/java/org/etsi/osl/osom/serviceactions/fetchAndTerminateScheduledServices.java
@@ -0,0 +1,44 @@
+package org.etsi.osl.osom.serviceactions;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.etsi.osl.tmf.common.model.service.ServiceStateType;
+import org.etsi.osl.tmf.sim638.model.ServiceUpdate;
+
+@Component(value = "fetchAndTerminateScheduledServices") // bean name
+public class fetchAndTerminateScheduledServices implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(FetchServiceQueueItems.class.getName());
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+
+ public void execute(DelegateExecution execution) {
+ logger.info("===================== fetchAndTerminateScheduledServices by Service Inventory Repository ====================");
+
+
+ List itemsToBeProcessed = serviceOrderManager.retrieveActiveServiceToTerminate();
+
+ if ( itemsToBeProcessed != null ) {
+ for (String serviceID : itemsToBeProcessed) {
+ logger.info("Will TERMINATE service with id: " + serviceID );
+
+ ServiceUpdate supd = new ServiceUpdate();
+ supd.setState( ServiceStateType.TERMINATED );
+ serviceOrderManager.updateService(serviceID, supd , true);
+
+ }
+ }
+
+
+ }
+
+}
diff --git a/src/main/resources/application-testing.yml b/src/main/resources/application-testing.yml
new file mode 100644
index 0000000000000000000000000000000000000000..5b2a03df755cc941a89945ecde2777dfb457b7df
--- /dev/null
+++ b/src/main/resources/application-testing.yml
@@ -0,0 +1,57 @@
+spring:
+ application:
+ name: openslice-osom
+ # datasource:
+ #url: jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
+ #password: sa
+ #username: sa
+ #jpa:
+ #database-platform: org.hibernate.dialect.H2Dialect
+ #hibernate:
+ #ddl-auto: create-drop
+ #hbm2ddl.auto: create-drop
+ #show-sql: false
+ #generate-ddl: true
+ # Embedded ActiveMQ Configuration Example
+ activemq:
+ broker-url: vm://embedded?broker.persistent=false,useShutdownHook=false
+ in-memory: true
+ non-blocking-redelivery: true
+ pool:
+ block-if-full: true
+ block-if-full-timeout: -1
+ create-connection-on-startup: true
+ enabled: false
+ expiry-timeout: 0
+ idle-timeout: 30000
+ max-connections: 1
+ maximum-active-session-per-connection: 500
+ reconnect-on-exception: true
+ time-between-expiration-check: -1
+ use-anonymous-producers: true
+ # Spring JMS Settings
+ jms:
+ listener:
+ acknowledge-mode: auto
+ auto-startup: true
+ concurrency: 5
+ max-concurrency: 10
+ pub-sub-domain: false
+ template:
+ default-destination:
+ delivery-mode: non_persistent
+ priority: 100
+ qos-enabled: true
+ receive-timeout: 1000
+ time-to-live: 36000
+
+logging:
+ level:
+ root: INFO
+ org.springframework: INFO
+ org.hibernate.SQL: INFO
+ org.hibernate.type.descriptor.sql.BasicBinder: INFO
+ org.etsi.osl.osom: DEBUG
+ pattern:
+ console: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
+ file: "%d %p %c{1.} [%t] %m%n"
\ No newline at end of file
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
new file mode 100644
index 0000000000000000000000000000000000000000..6f930df9c4a8ad41d40998004d5e6bc7bde5d0c1
--- /dev/null
+++ b/src/main/resources/application.yml
@@ -0,0 +1,111 @@
+server:
+ port: 13100
+
+spring:
+ application:
+ name: openslice-osom
+ datasource:
+ url: jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
+ password: sa
+ username: sa
+ jpa:
+ database-platform: org.hibernate.dialect.H2Dialect
+ hibernate:
+ ddl-auto: create-drop
+ hbm2ddl.auto: create-drop
+ show-sql: false
+ generate-ddl: true
+ properties.hibernate.current_session_context_class: org.springframework.orm.hibernate5.SpringSessionContext
+ properties:
+ hibernate:
+ connection:
+ characterEncoding: utf-8
+ CharSet: utf-8
+ useUnicode: true
+ activemq:
+ brokerUrl: tcp://localhost:61616?jms.watchTopicAdvisories=false
+ user: artemis
+ password: artemis
+ pool:
+ enabled: true
+ max-connections: 100
+ packages:
+ trust-all: true
+
+
+logging:
+ level:
+ root: INFO
+ org.etsi.osl.osom: DEBUG
+ org.springframework: INFO
+ org.apache.camel: INFO
+ reactor.netty.tcp.TcpClient: INFO
+ reactor.netty.http.client.HttpClient: INFO
+ pattern:
+ console: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
+ file: "%d %p %c{1.} [%t] %m%n"
+
+THIS_PARTNER_NAME: "demo-openslice.io"
+
+CATALOG_GET_SERVICEORDERS: "jms:queue:CATALOG.GET.SERVICEORDERS"
+CATALOG_GET_SERVICEORDER_BY_ID: "jms:queue:CATALOG.GET.SERVICEORDER_BY_ID"
+CATALOG_ADD_SERVICEORDER: "jms:queue:CATALOG.ADD.SERVICEORDER"
+CATALOG_UPD_SERVICEORDER_BY_ID: "jms:queue:CATALOG.UPD.SERVICEORDER_BY_ID"
+CATALOG_GET_INITIAL_SERVICEORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_SERVICEORDERS"
+CATALOG_GET_SERVICEORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_SERVICEORDERS"
+CATALOG_ADD_SERVICE: "jms:queue:CATALOG.ADD.SERVICE"
+CATALOG_UPD_SERVICE: "jms:queue:CATALOG.UPD.SERVICE"
+CATALOG_GET_SERVICE_BY_ID: "jms:queue:CATALOG.GET.SERVICE"
+CATALOG_GET_SERVICE_BY_ORDERID: "jms:queue:CATALOG.GET.SERVICE_BY_ORDERID"
+CATALOG_SERVICE_QUEUE_ITEMS_GET: "jms:queue:CATALOG.SERVICEQUEUEITEMS.GET"
+CATALOG_SERVICE_QUEUE_ITEM_UPD: "jms:queue:CATALOG.SERVICEQUEUEITEM.UPDATE"
+CATALOG_SERVICE_QUEUE_ITEM_DELETE: "jms:queue:CATALOG.SERVICEQUEUEITEM.DELETE"
+CATALOG_GET_SERVICESPEC_BY_ID: "jms:queue:CATALOG.GET.SERVICESPEC_BY_ID"
+CATALOG_SERVICES_TO_TERMINATE: "jms:queue:CATALOG.GET.SERVICETOTERMINATE"
+CATALOG_SERVICES_OF_PARTNERS: "jms:queue:CATALOG.GET.SERVICESOFPARTNERS"
+
+CATALOG_GET_PARTNER_ORGANIZATON_BY_ID: "jms:queue:CATALOG.GET.PARTNER_ORGANIZATION_BY_ID"
+CATALOG_UPDATE_PARTNER_ORGANIZATION: "jms:queue:CATALOG.UPD.PARTNER_ORGANIZATION"
+CATALOG_GET_EXTERNAL_SERVICE_PARTNERS: "jms:queue:CATALOG.GET.EXTERNALSERVICEPARTNERS"
+CATALOG_UPD_EXTERNAL_SERVICESPEC: "jms:queue:CATALOG.UPD.EXTERNAL_SERVICESPEC"
+
+NFV_CATALOG_DEPLOY_NSD_REQ: "jms:queue:NFVCATALOG.DEPLOY.NSD_REQ"
+NFV_CATALOG_GET_DEPLOYMENT_BY_ID : "jms:queue:NFVCATALOG.GET.DEPLOYMENT_BY_ID"
+NFV_CATALOG_GET_NSD_BY_ID: "jms:queue:NFVCATALOG.GET.NSD_BY_ID"
+NFV_CATALOG_UPD_DEPLOYMENT_BY_ID: "jms:queue:NFVCATALOG.UPD.DEPLOYMENT_BY_ID"
+NFV_CATALOG_NS_DAY2_ACTION: "jms:queue:ns.action.run"
+
+#NS ACTIONS
+NFV_CATALOG_NSACTIONS_SCALE: "jms:queue:NSACTIONS.SCALE"
+
+#ALARMS
+ALARMS_ADD_ALARM: "jms:queue:ALARMS.ADD.ALARM"
+ALARMS_UPDATE_ALARM: "jms:queue:ALARMS.UPDATE.ALARM"
+ALARMS_GET_ALARM: "jms:queue:ALARMS.GET.ALARM"
+
+#LCM MESSAGES
+CATALOG_GET_LCMRULE_BY_ID: "jms:queue:CATALOG.GET.LCMRULE"
+CATALOG_GET_LCMRULES_BY_SPECID_PHASE: "jms:queue:CATALOG.GET.LCMRULES_BY_SPECID_PHASE"
+
+#SERVICE_TEST
+CATALOG_GET_SERVICETESTSPEC_BY_ID: "jms:queue:CATALOG.GET.SERVICETESTSPEC_BY_ID"
+CATALOG_ADD_SERVICETEST: "jms:queue:CATALOG.ADD.SERVICETEST"
+CATALOG_UPD_SERVICETEST: "jms:queue:CATALOG.UPD.SERVICETEST"
+CATALOG_GET_SERVICETEST_BY_ID: "jms:queue:CATALOG.GET.SERVICETEST"
+
+
+#RESOURCES MESSAGES
+CATALOG_ADD_RESOURCE: "jms:queue:CATALOG.ADD.RESOURCE"
+CATALOG_UPD_RESOURCE: "jms:queue:CATALOG.UPD.RESOURCE"
+CATALOG_UPDADD_RESOURCE: "jms:queue:CATALOG.UPDADD.RESOURCE"
+CATALOG_GET_RESOURCE_BY_ID: "jms:queue:CATALOG.GET.RESOURCE"
+CATALOG_ADD_RESOURCESPEC: "jms:queue:CATALOG.ADD.RESOURCESPEC"
+CATALOG_UPD_RESOURCESPEC: "jms:queue:CATALOG.UPD.RESOURCESPEC"
+CATALOG_UPDADD_RESOURCESPEC: "jms:queue:CATALOG.UPDADD.RESOURCESPEC"
+CATALOG_GET_RESOURCESPEC_BY_ID: "jms:queue:CATALOG.GET.RESOURCESPEC_BY_ID"
+CATALOG_GET_RESOURCESPEC_BY_ΝAME_CATEGORY: "jms:queue:CATALOG.GET.RESOURCESPEC_BY_ΝAME_CATEGORY"
+
+#CRD ACTIONS
+CRD_DEPLOY_CR_REQ: "jms:queue:CRD.DEPLOY.CR_REQ"
+CRD_DELETE_CR_REQ: "jms:queue:CRD.DELETE.CR_REQ"
+CRD_PATCH_CR_REQ: "jms:queue:CRD.PATCH.CR_REQ"
\ No newline at end of file
diff --git a/src/main/resources/dmn/genericdecisions.dmn b/src/main/resources/dmn/genericdecisions.dmn
new file mode 100644
index 0000000000000000000000000000000000000000..cc7c320d93fe8e279aee51fd36dcb6f709ad6cb1
--- /dev/null
+++ b/src/main/resources/dmn/genericdecisions.dmn
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+ Uplink_throughput_per_UE__Guaranteed_uplink_throughput
+
+
+
+
+
+
+ 10]]>
+
+
+ 192
+
+
+ 1024
+
+
+
+
+
+
+
+ 64
+
+
+ 512
+
+
+
+
+
+
+
+ 192
+
+
+ 512
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6a53ea9eb2a42dc6edf5c205a975cb80b15b7dae
--- /dev/null
+++ b/src/main/resources/logback.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ app.log
+
+
+ logs/archived/app.%d{yyyy-MM-dd}.%i.log
+
+ 10MB
+
+ 20GB
+
+ 60
+
+
+
+ %d %p %c{1.} [%t] %m%n
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/processes/CRDeploymentReq.bpmn b/src/main/resources/processes/CRDeploymentReq.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..a4976882c7cb35d9043ebb1d32722ef9502942c9
--- /dev/null
+++ b/src/main/resources/processes/CRDeploymentReq.bpmn
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ PT30S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/CheckInProgressOrders.bpmn b/src/main/resources/processes/CheckInProgressOrders.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..b04dcc7facdeb2438873240097e601c33cb44c87
--- /dev/null
+++ b/src/main/resources/processes/CheckInProgressOrders.bpmn
@@ -0,0 +1,37 @@
+
+
+
+
+
+ 0/20 * * * * ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/ExternalSPDeploymentReq.bpmn b/src/main/resources/processes/ExternalSPDeploymentReq.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..f32fd17fa9257f7a7b63966a335976fb71b294ad
--- /dev/null
+++ b/src/main/resources/processes/ExternalSPDeploymentReq.bpmn
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ PT60S
+
+
+
+
+
+
+
+
+
+
+
+ Timer start wait 60 secs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/LocalServiceOrchestrationProcess.bpmn b/src/main/resources/processes/LocalServiceOrchestrationProcess.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..d6fde539c5e16c91bfb384748cad9aaeb9abd6e5
--- /dev/null
+++ b/src/main/resources/processes/LocalServiceOrchestrationProcess.bpmn
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PT30S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/NFVODeploymentReq.bpmn b/src/main/resources/processes/NFVODeploymentReq.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..65e8648417d8315040977417bbe86c42d277906e
--- /dev/null
+++ b/src/main/resources/processes/NFVODeploymentReq.bpmn
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PT30S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/OrderScheduler.bpmn b/src/main/resources/processes/OrderScheduler.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..80d72c9c4aecc28f1e9e173975d0e3b13d6d37c1
--- /dev/null
+++ b/src/main/resources/processes/OrderScheduler.bpmn
@@ -0,0 +1,55 @@
+
+
+
+
+
+ 0 0/1 * * * ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/ProcessOrderItemProcess.bpmn b/src/main/resources/processes/ProcessOrderItemProcess.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..4f386ce6a8bc381dd822dce0f16c5f7092f9d025
--- /dev/null
+++ b/src/main/resources/processes/ProcessOrderItemProcess.bpmn
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/ServiceActionProcess.bpmn b/src/main/resources/processes/ServiceActionProcess.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..ef94cc7b313506d72e9738e90552f6d940e14017
--- /dev/null
+++ b/src/main/resources/processes/ServiceActionProcess.bpmn
@@ -0,0 +1,253 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/ServiceActionQueue.bpmn b/src/main/resources/processes/ServiceActionQueue.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..f5368a89a7c2ace4162f94cf13bab70f622cb468
--- /dev/null
+++ b/src/main/resources/processes/ServiceActionQueue.bpmn
@@ -0,0 +1,37 @@
+
+
+
+
+
+ 0/30 * * * * ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/ServiceCreationProcess.bpmn b/src/main/resources/processes/ServiceCreationProcess.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..8283480a849adba0cabc71fccdc891ff010987a5
--- /dev/null
+++ b/src/main/resources/processes/ServiceCreationProcess.bpmn
@@ -0,0 +1,299 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PT15S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PT15S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/ServiceTestOrchestrationProcess.bpmn b/src/main/resources/processes/ServiceTestOrchestrationProcess.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..f668b8651be48d8a70840fc714aaf98a9c96fe81
--- /dev/null
+++ b/src/main/resources/processes/ServiceTestOrchestrationProcess.bpmn
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PT30S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/StartOrderProcessProcess.bpmn b/src/main/resources/processes/StartOrderProcessProcess.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..f29853c12654884b090986fe439ab9e0858e72db
--- /dev/null
+++ b/src/main/resources/processes/StartOrderProcessProcess.bpmn
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/SyncPartnerServiceInventory.bpmn b/src/main/resources/processes/SyncPartnerServiceInventory.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..c5449116ee3bc6f5b588c67870177d25a7fe4a55
--- /dev/null
+++ b/src/main/resources/processes/SyncPartnerServiceInventory.bpmn
@@ -0,0 +1,36 @@
+
+
+
+ This process will sync any local service proxies we havein the local repository with the actual remote services in partner domain and sync characteristics and status
+
+
+ 0/30 * * * * ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/TerminateScheduledServices.bpmn b/src/main/resources/processes/TerminateScheduledServices.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..68e189c1efa72e4ceb1845ea71d849d48b22fc25
--- /dev/null
+++ b/src/main/resources/processes/TerminateScheduledServices.bpmn
@@ -0,0 +1,35 @@
+
+
+
+
+
+ 0 0/1 * * * ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/processes/fetchPartnerServices.bpmn b/src/main/resources/processes/fetchPartnerServices.bpmn
new file mode 100644
index 0000000000000000000000000000000000000000..9831b9fbcb9f9438ec15ed79c3bfcd4854367be8
--- /dev/null
+++ b/src/main/resources/processes/fetchPartnerServices.bpmn
@@ -0,0 +1,37 @@
+
+
+
+
+
+ 0 0/30 * * * ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/org/etsi/osl/osom/ExternalSImportClientFlowone.java b/src/test/java/org/etsi/osl/osom/ExternalSImportClientFlowone.java
new file mode 100644
index 0000000000000000000000000000000000000000..e98ea1b0424fd6f98970f90df01a6d3519b5aaf9
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/ExternalSImportClientFlowone.java
@@ -0,0 +1,160 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import java.util.List;
+
+import javax.net.ssl.SSLException;
+import org.etsi.osl.osom.partnerservices.GenericClient;
+import org.flowable.spring.impl.test.FlowableSpringExtension;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
+import org.springframework.web.reactive.function.client.WebClient;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import reactor.core.publisher.Mono;
+
+
+public class ExternalSImportClientFlowone {
+
+
+ private static final transient Logger log = LoggerFactory.getLogger( ExternalSImportClientFlowone.class.getName());
+
+
+
+
+ public static void main(String[] args) throws Exception {
+
+ GenericClient oac = new GenericClient(
+
+ "aflowone",
+ "flowone",
+ "",
+ new String[0],
+ "http://10.0.96.9:58281/oauth/token",
+ "test3",
+ "password",
+ "http://10.0.96.9:58281" );
+
+ WebClient webClient;
+ webClient = oac.createWebClient();
+
+
+ ServiceSpecification specs = webClient.get()
+ .uri("/flowone/v1/servicecatalog?name=NetworkSlice")
+ .attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("aflowone"))
+ .retrieve()
+ .bodyToMono( new ParameterizedTypeReference< ServiceSpecification>() {})
+ .block();
+
+
+ System.out.println("order date: " + specs.toString() );
+
+// if ( specs!=null ) {
+// for (ServiceSpecification o : specs) {
+// System.out.println("order date: " + o.toString() );
+//
+// }
+// }
+
+//
+//
+//
+//
+//
+//
+// ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
+// .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1)).build(); //spring.codec.max-in-memory-size=-1 ?? if use autoconfiguration
+//
+// var tcpClient = TcpClient.create()
+// .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 2_000)
+// .doOnConnected(connection ->
+// connection.addHandlerLast(new ReadTimeoutHandler(2))
+// .addHandlerLast(new WriteTimeoutHandler(2)));
+// SslContext sslContext = SslContextBuilder
+// .forClient()
+// .trustManager(InsecureTrustManagerFactory.INSTANCE)
+// .build();
+// WebClient webClient3 = WebClient.builder()
+// .exchangeStrategies(exchangeStrategies)
+// .clientConnector(new ReactorClientHttpConnector(
+// HttpClient.from(tcpClient)
+// .secure( sslContextSpec -> sslContextSpec.sslContext(sslContext) ))
+// )
+// .baseUrl("https://patras5g.eu")
+// .defaultCookie("cookieKey", "cookieValue")
+// .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
+// .filter(ExchangeFilterFunctions.basicAuthentication("username", "pass"))
+// .defaultUriVariables(Collections.singletonMap("url", "https://patras5g.eu"))
+// .build();
+//
+// String resp= webClient3.get()
+// .uri("/apiportal/services/api/repo/vxfs")
+// .attributes( ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("authOpensliceProvider"))
+// .retrieve()
+// .onStatus(HttpStatus::is4xxClientError, response -> {
+// System.out.println("4xx eror");
+// return Mono.error(new RuntimeException("4xx"));
+// })
+// .onStatus(HttpStatus::is5xxServerError, response -> {
+// System.out.println("5xx eror");
+// return Mono.error(new RuntimeException("5xx"));
+// })
+// .bodyToMono( String.class)
+// .block();
+//
+//
+// System.out.println("resp: " + resp );
+ }
+
+ private ExchangeFilterFunction logRequest() {
+ return (clientRequest, next) -> {
+ log.info("Request: {} {}", clientRequest.method(), clientRequest.url());
+ log.info("--- Http Headers: ---");
+ clientRequest.headers().forEach(this::logHeader);
+ log.info("--- Http Cookies: ---");
+ clientRequest.cookies().forEach(this::logHeader);
+ return next.exchange(clientRequest);
+ };
+ }
+
+ private ExchangeFilterFunction logResponse() {
+ return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> {
+ log.info("Response: {}", clientResponse.statusCode());
+ clientResponse.headers().asHttpHeaders()
+ .forEach((name, values) -> values.forEach(value -> log.info("{}={}", name, value)));
+ return Mono.just(clientResponse);
+ });
+ }
+
+
+ private void logHeader(String name, List values) {
+ values.forEach(value -> log.info("{}={}", name, value));
+ }
+
+
+
+}
diff --git a/src/test/java/org/etsi/osl/osom/LCMIntegrationTest.java b/src/test/java/org/etsi/osl/osom/LCMIntegrationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..0470c3b6ce48d85c9057b207cee9dea2610f776b
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/LCMIntegrationTest.java
@@ -0,0 +1,354 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesExecutor;
+import org.etsi.osl.osom.lcm.LCMRulesExecutorVariables;
+import org.etsi.osl.osom.lcm.LcmBaseExecutor;
+import org.flowable.engine.RepositoryService;
+import org.flowable.spring.impl.test.FlowableSpringExtension;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.event.annotation.BeforeTestExecution;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.EValueType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristicValue;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.ServiceCreate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+
+@ExtendWith(FlowableSpringExtension.class)
+@SpringBootTest(properties = {
+ "THIS_PARTNER_NAME = demo-openslice.io",
+ "CATALOG_GET_SERVICEORDER_BY_ID = direct:get_mocked_order",
+ "CATALOG_GET_SERVICESPEC_BY_ID = direct:get_mocked_spec", "CATALOG_ADD_SERVICE = direct:get_mocked_add_service",
+ "CATALOG_UPD_SERVICEORDER_BY_ID = direct:get_mocked_upd_order",
+ "CATALOG_ADD_SERVICEORDER = direct:get_mocked_upd_order",
+ "CATALOG_GET_SERVICE_BY_ID = direct:get_mocked_service_id",
+ "CATALOG_SERVICE_QUEUE_ITEMS_GET: direct:get_mocked_service_queueitems",
+ "CATALOG_SERVICE_QUEUE_ITEM_UPD: direct:get_mocked_service_id",
+ "CATALOG_SERVICE_QUEUE_ITEM_DELETE: direct:get_mocked_service_id",
+ "CATALOG_UPD_SERVICE = direct:get_mocked_upd_service",
+ "NFV_CATALOG_DEPLOY_NSD_REQ = direct:req_deploy_nsd",
+ "CATALOG_GET_LCMRULE_BY_ID = direct:get_mocked_lcmrulebyid",
+ "CATALOG_GET_LCMRULES_BY_SPECID_PHASE = direct:get_mocked_lcmrulesbyspecid",
+ "CATALOG_SERVICES_OF_PARTNERS = direct:get_mocked_service_queueitems",
+ "CATALOG_SERVICES_TO_TERMINATE = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICE_BY_ORDERID = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICEORDER_IDS_BY_STATE = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_PARTNER_ORGANIZATON_BY_ID = direct:get_mocked_service_queueitems",
+ "NFV_CATALOG_NS_DAY2_ACTION = direct:get_mocked_service_queueitems",
+ "NFV_CATALOG_NSACTIONS_SCALE = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_EXTERNAL_SERVICE_PARTNERS = direct:get_mocked_service_queueitems",
+ "CATALOG_UPD_EXTERNAL_SERVICESPEC = direct:get_mocked_service_queueitems",
+ "CATALOG_UPDATE_PARTNER_ORGANIZATION = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICETESTSPEC_BY_ID = direct:get_mocked_service_queueitems",
+ "CATALOG_ADD_SERVICETEST = direct:get_mocked_service_queueitems",
+ "CATALOG_UPD_SERVICETEST = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICETEST_BY_ID = direct:get_mocked_service_queueitems",
+
+ "ALARMS_ADD_ALARM=mock:output",
+ "ALARMS_UPDATE_ALARM=mock:output",
+ "ALARMS_GET_ALARM=mock:output",
+ "NFV_CATALOG_GET_DEPLOYMENT_BY_ID = direct:req_deployment_id",
+ "NFV_CATALOG_UPD_DEPLOYMENT_BY_ID = direct:req_deployment_id",
+ "NFV_CATALOG_GET_NSD_BY_ID = direct:req_nsd_id",
+ "uri.to = mock:output" })
+@ActiveProfiles("testing")
+public class LCMIntegrationTest {
+ private static final transient Log logger = LogFactory.getLog(LCMIntegrationTest.class.getName());
+
+ @Autowired
+ RepositoryService repositoryService;
+
+
+ RoutesBuilder builder = new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:get_mocked_order").bean(scmocked, "getOrderById");
+ from("direct:get_mocked_spec").bean(scmocked, "getSpecById");
+ from("direct:get_mocked_add_service").bean(scmocked, "getMockedAddService");
+ from("direct:get_mocked_upd_service").bean(scmocked, "getMockedService");
+ from("direct:get_mocked_upd_order").bean(scmocked, "updateServiceOrder");
+ from("direct:get_mocked_service_id").bean(scmocked, "getServiceById");
+ from("direct:get_mocked_service_queueitems").bean(scmocked, "getServiceQueueItems");
+ from("direct:get_mocked_lcmrulebyid").bean(scmocked, "getLCMRulebyID");
+ from("direct:get_mocked_lcmrulesbyspecid").bean(scmocked, "getLCMRulesbySpecIDPhase(${header.servicespecid}, ${header.phasename})");
+ from("direct:req_deploy_nsd").bean(scmocked, "req_deploy_nsd");
+ from("direct:req_deployment_id").bean(scmocked, "req_deployment_id");
+ from("direct:req_nsd_id").bean(scmocked, "req_nsd_id");
+
+ };
+ };
+
+
+
+ SCMocked scmocked = new SCMocked();
+
+ public ServiceCreate setupServiceCreate(ServiceSpecification aServiceSpec ) throws IOException {
+
+ ServiceCreate aService;
+
+
+ aService = new ServiceCreate();
+ aService.setServiceCharacteristic( new ArrayList<>() );
+ for (ServiceSpecCharacteristic sourceCharacteristic : aServiceSpec.getServiceSpecCharacteristic()) {
+ Characteristic newChar = new Characteristic();
+ newChar.setName( sourceCharacteristic.getName() );
+ newChar.setValueType( sourceCharacteristic.getValueType() );
+
+ if ( sourceCharacteristic.getValueType() != null && sourceCharacteristic.getValueType().equals( EValueType.ARRAY.getValue() ) ||
+ sourceCharacteristic.getValueType() != null && sourceCharacteristic.getValueType().equals( EValueType.SET.getValue() ) ) {
+ String valString = "";
+ for (ServiceSpecCharacteristicValue specchar : sourceCharacteristic.getServiceSpecCharacteristicValue()) {
+ if ( ( specchar.isIsDefault()!= null) && specchar.isIsDefault() ) {
+ if ( !valString.equals("")) {
+ valString = valString + ",";
+ }
+ valString = valString + "{\"value\":\"" + specchar.getValue().getValue() + "\",\"alias\":\"" + specchar.getValue().getAlias() + "\"}";
+ }
+
+ }
+ newChar.setValue( new Any( "[" + valString + "]", "") );
+ } else {
+ for (ServiceSpecCharacteristicValue specchar : sourceCharacteristic.getServiceSpecCharacteristicValue()) {
+ if ( ( specchar.isIsDefault()!= null) && specchar.isIsDefault() ) {
+ newChar.setValue( new Any(
+ specchar.getValue().getValue(),
+ specchar.getValue().getAlias()) );
+ break;
+ }
+ }
+ }
+
+
+ if ( newChar.getValue() !=null) {
+ aService.getServiceCharacteristic().add(newChar );
+ } else {
+ newChar.setValue( new Any(
+ "",
+ "") );
+ aService.getServiceCharacteristic().add(newChar );
+ }
+ }
+
+ return aService;
+ }
+
+
+
+ @Test
+ public void testLcmBaseExecutorAPIs() throws Exception {
+
+ logger.debug("===============TEST START testLcmBaseExecutorAPIs =============================");
+ /**
+ * Tests to perform and enhance API
+ * - Functions for ValueTypes (enum, Set, Arrays, numbers, etc)
+ * -String, Integer OK
+ * - Evaluate parameter values inside a json OK
+ * - Have variables: String, Integer OK
+ * - Operation for new Service Order (+ include sepc with its parameters..)
+ * - Operations for REST services
+ *
+ */
+
+
+
+ class LcmBaseExecutorC extends LcmBaseExecutor {
+ @Override
+ public void exec() {
+ }
+
+
+
+
+ }
+
+
+ String sspectex = scmocked.getSpecById("f2b74f90-4140-4895-80d1-ef243398117b");
+ ServiceSpecification aServiceSpec = SCMocked.toJsonObj( sspectex, ServiceSpecification.class);
+ ServiceCreate aService = setupServiceCreate(aServiceSpec);
+
+ LcmBaseExecutorC be = new LcmBaseExecutorC();
+ LCMRuleSpecification lcmspec = scmocked.getLCMRulebyIDJson("40f027b5-24a9-4db7-b422-a963c9feeb7a");
+ be.setLcmspec( lcmspec );
+ LCMRulesExecutorVariables vars = new LCMRulesExecutorVariables(aServiceSpec, new ServiceOrder(), null, aService, null, null, null);
+ be.setVars( vars );
+ assertThat( be.getCharValFromStringType("cirros_2vnf_ns::SSHKEY") ).isEqualTo("MYKEYX");
+ assertThat( be.getCharValAsString("cirros_2vnf_ns::SSHKEY") ).isEqualTo("MYKEYX");
+ assertThat( be.getCharValAsString("Quality Class") ).isEqualTo("0");
+ assertThat( be.getCharValFromBooleanType("High Availability") ).isEqualTo(false);
+
+
+
+ sspectex = scmocked.getSpecById("0d5551e6-069f-43b7-aa71-10530f290239");
+ aServiceSpec = SCMocked.toJsonObj( sspectex, ServiceSpecification.class);
+ aService = setupServiceCreate(aServiceSpec);
+ be = new LcmBaseExecutorC();
+ be.setLcmspec( lcmspec );
+ vars = new LCMRulesExecutorVariables(aServiceSpec, new ServiceOrder(), null, aService, null, null, null);
+ be.setVars( vars );
+
+ be.setCharValFromBooleanType("High Availability", true);
+ assertThat( be.getCharValFromBooleanType("High Availability") ).isEqualTo(true);
+ assertThat( be.checkIfSetContainsValue(be.getCharValFromSetType("Area of Service"), "GR") ).isEqualTo(true);
+ assertThat( be.checkIfSetContainsValue(be.getCharValFromSetType("Area of Service"), "ES") ).isEqualTo(true);
+ assertThat( be.checkIfSetContainsValue(be.getCharValFromSetType("Area of Service"), "XXX") ).isEqualTo(false);
+
+ be.setCharValFromSetType("cirros_2vnf_nsd::Primitive::fsetup", "[{\"value\":\"1\",\"alias\":\"member_vnf_index\"},{\"value\":\"fsetup\",\"alias\":\"primitive\"},{\"value\":\"{ \\\"tvg\\\": { \\\"ip\\\": \\\"\\\", \\\"channel1\\\": { \\\"mode\\\": \\\"0\\\" } } }\",\"alias\":\"confjson\"}]");
+
+ assertThat( be.checkIfSetContainsValue(be.getCharValFromSetType("cirros_2vnf_nsd::Primitive::fsetup"), "fsetup") ).isEqualTo(true);
+
+ be.setCharValFromSetType("cirros_2vnf_nsd::Primitive::fsetup", "[{\"value\":\"1\",\"alias\":\"member_vnf_index\"},{\"value\":\"fsetupchanged\",\"alias\":\"primitive\"},{\"value\":\"{ \\\"tvg\\\": { \\\"ip\\\": \\\"\\\", \\\"channel1\\\": { \\\"mode\\\": \\\"0\\\" } } }\",\"alias\":\"confjson\"}]");
+ assertThat( be.checkIfSetContainsValue(be.getCharValFromSetType("cirros_2vnf_nsd::Primitive::fsetup"), "fsetupchanged") ).isEqualTo(true);
+
+
+ assertThat( be.getJsonValueAsStringFromField( sspectex , "uuid" ) ).isEqualTo( "0d5551e6-069f-43b7-aa71-10530f290239" );
+ //logger.debug( "be from json: "+ be.getJsonValueAsStringFromField( sspectex , "serviceSpecCharacteristic" ) );
+
+ String jsonArray = be.getJsonValueAsStringFromField( sspectex , "serviceSpecCharacteristic" );
+ assertThat( be.getElementInJsonArrayFromIndex( jsonArray , 1 ) ).contains( "Area of Service" );
+ //logger.debug( "be from json: "+ be.getElementInJsonArrayFromIndex( jsonArray , 1 ) );
+
+ String areaChar = be.getElementInJsonArrayFromIndex( jsonArray , 1 );
+ jsonArray = be.getJsonValueAsStringFromField( areaChar , "serviceSpecCharacteristicValue" );
+
+ String jsonServiceSpecCharacteristicValue = be.getElementInJsonArrayFromFieldValue( jsonArray , "uuid", "1423ac7a-bdb5-44dd-b4cb-8278d4308061" );
+
+ String areavalue = be.getJsonValueAsStringFromField( jsonServiceSpecCharacteristicValue , "value" );
+ String areavalueAlias = be.getJsonValueAsStringFromField( areavalue , "alias" );
+ assertThat( areavalueAlias ).isEqualTo( "Spain" );
+
+
+ //via jsonpath
+ //try paths to http://jsonpath.herokuapp.com/
+ String countryVal = be.getValueFromJsonPath( sspectex , "$.serviceSpecCharacteristic[?(@.name == 'Area of Service')].serviceSpecCharacteristicValue[?(@.value.alias=='Spain')].value.value" );
+ assertThat( countryVal ).isEqualTo( "ES" );
+ countryVal = be.getValueFromJsonPath( sspectex , "$.serviceSpecCharacteristic[?(@.name == 'Area of Service')].serviceSpecCharacteristicValue[?(@.uuid=='85ef658d-5de1-49dd-a4fd-a17f8d717e1b')].value.value" );
+ assertThat( countryVal ).isEqualTo( "IT" );
+
+ countryVal = be.getValueFromJsonPath("{\"uuid\":\"843355a4-37b7-4509-94e3-cfc26a05f2fb\",\"endDate\":\"2021-09-16T21:34:49Z\",\"startDate\":\"2021-09-15T21:42:11Z\",\"description\":\"A Service for Open5GCore-2enb_nsd\",\"@baseType\":\"BaseRootNamedEntity\",\"@schemaLocation\":null,\"@type\":\"CustomerFacingServiceSpecification\",\"href\":null,\"name\":\"Open5GCore-2enb_nsd\",\"id\":\"843355a4-37b7-4509-94e3-cfc26a05f2fb\",\"category\":\"CustomerFacingServiceSpecification\",\"hasStarted\":false,\"isServiceEnabled\":false,\"isStateful\":null,\"serviceDate\":\"2021-09-15T21:42:11.003030097Z\",\"serviceType\":\"Open5GCore-2enb_nsd\",\"startMode\":\"MANUALLY_BY_SERVICE_PROVIDER\",\"note\":[{\"uuid\":\"807365be-e420-4136-a9bd-29a4268b2df1\",\"date\":\"2021-09-15T21:44:54Z\",\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"author\":\"openslice-osom\",\"system\":null,\"text\":\"Service Action HandleManuallyAction. Terminated Action: TERMINATE\"},{\"uuid\":\"4d40f73b-82fa-4b43-bdb7-ea575530f581\",\"date\":\"2021-09-15T21:44:14Z\",\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"author\":\"openslice-osom\",\"system\":null,\"text\":\"Service Action HandleManuallyAction. Terminated Action: NONE\"},{\"uuid\":\"4f395663-79da-4ed6-8042-c009b80ba86d\",\"date\":\"2021-09-15T21:44:14Z\",\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"author\":\"openslice-osom\",\"system\":null,\"text\":\"Service Action HandleManuallyAction. Terminated Action: NONE\"},{\"uuid\":\"e76ae3a7-525d-4e5e-ae1b-4d549db82288\",\"date\":\"2021-09-15T21:44:04Z\",\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"author\":\"openslice-osom\",\"system\":null,\"text\":\"Service Action HandleManuallyAction. Terminated Action: TERMINATE\"},{\"uuid\":\"7c30df0c-1e8c-42e3-9aab-3150e3d6e486\",\"date\":\"2021-09-15T21:42:11Z\",\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"author\":\"API\",\"system\":null,\"text\":\"Service reserved\"},{\"uuid\":\"99fdd422-c3f0-4037-bc56-6215101587d0\",\"date\":\"2021-09-15T21:42:11Z\",\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"author\":\"openslice-osom\",\"system\":null,\"text\":\"Service Created by AutomationCheck\"},{\"uuid\":\"ff6fca28-cbb8-4170-9980-46149a15f5f7\",\"date\":\"2021-09-15T21:43:06Z\",\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"author\":\"API\",\"system\":null,\"text\":\"Service terminated\"}],\"place\":[],\"relatedParty\":[{\"uuid\":\"79b3b88d-c64b-4405-b765-867ae6f4277f\",\"@baseType\":\"BaseRootEntity\",\"@schemaLocation\":null,\"@type\":\"org.etsi.osl.tmf.prm669.model.RelatedParty\",\"href\":null,\"name\":\"anonymousUser\",\"role\":\"OWNER\",\"@referredType\":\"SimpleUsername_Individual\",\"id\":null,\"extendedInfo\":null}],\"serviceCharacteristic\":[{\"uuid\":\"284aa4ab-3b04-45d0-9355-c1594e48cf18\",\"value\":{\"value\":\"691c8956-0369-4b91-b914-b61dccba74db\",\"alias\":\"Cloudville\"},\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"name\":\"VIM\",\"valueType\":\"ENUM\"},{\"uuid\":\"3b299d33-bf01-4364-8c52-01aef7451c15\",\"value\":{\"value\":\"myNsNAME\",\"alias\":null},\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"name\":\"nsName\",\"valueType\":\"TEXT\"},{\"uuid\":\"0f5da375-cccc-47d9-9758-42ff30352009\",\"value\":{\"value\":\"e12d6ef5-4f64-4be3-bc46-fcf2946eb881\",\"alias\":\"nsdId\"},\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"name\":\"deployId\",\"valueType\":\"TEXT\"}],\"serviceOrder\":[{\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"id\":\"9cee8f99-6b75-4541-8d2e-c8739656d3b8\",\"serviceOrderItemId\":\"adf31267-6bb3-4009-a972-4bc0178108c1\",\"@referredType\":null}],\"serviceRelationship\":[],\"serviceSpecification\":{\"@baseType\":\"BaseEntity\",\"@schemaLocation\":null,\"@type\":null,\"href\":null,\"name\":\"Open5GCore-2enb_nsd\",\"version\":null,\"targetServiceSchema\":null,\"@referredType\":null,\"id\":\"2d2bd5b2-c4ef-44bb-8796-6360ae8f5581\"},\"state\":\"terminated\",\"supportingResource\":[],\"supportingService\":[]}", "$.serviceCharacteristic[?(@.name == 'deployId')].value.value");
+ assertThat( countryVal ).isEqualTo( "e12d6ef5-4f64-4be3-bc46-fcf2946eb881" );
+
+ //logger.debug( "be from json: "+ be.getValueFromJsonPath( sspectex , "$.serviceSpecCharacteristic[?(@.name == 'Area of Service')].serviceSpecCharacteristicValue[?(@.value.alias=='Spain')].value.value" ) );
+
+
+ logger.debug("===============TEST END testLcmBaseExecutorAPIs =============================");
+
+ }
+
+ @Test
+ public void testExecRuleSpec() throws Exception {
+
+ logger.debug("===============TEST START testExecRuleSpec =============================");
+
+ //TestExSpec3.json
+ String sspectex = scmocked.getSpecById("0d5551e6-069f-43b7-aa71-10530f290239");
+ ServiceSpecification aServiceSpec = SCMocked.toJsonObj( sspectex, ServiceSpecification.class);
+ ServiceCreate aService = setupServiceCreate(aServiceSpec);
+
+ LCMRulesExecutorVariables vars = new LCMRulesExecutorVariables(aServiceSpec, new ServiceOrder(), null, aService, null, null, null);
+ LCMRulesExecutor lcmRulesExecutor = new LCMRulesExecutor();
+ //check LcmCirrosRule3Test code for error (more complex code)
+
+ logger.debug( "BEFORE vars.getServiceToCreate() = " + vars.getServiceToCreate().toString() );
+ LCMRuleSpecification lcs = scmocked.getLCMRulebyIDJson("8b7b8339-0c33-4731-af9c-c98adadbe777");
+ vars = lcmRulesExecutor.executeLCMRuleCode( lcs, vars);
+ assertThat( vars.getCompileDiagnosticErrors().size() ).isEqualTo(0);
+ logger.debug( "AFTER EXEC vars.getServiceToCreate() = " + vars.getServiceToCreate().toString() );
+
+ //TestExBundleSpec.json
+ sspectex = scmocked.getSpecById("f2b74f90-4140-4895-80d1-ef243398117b");
+ aServiceSpec = SCMocked.toJsonObj( sspectex, ServiceSpecification.class);
+ aService = setupServiceCreate(aServiceSpec);
+
+ lcs = scmocked.getLCMRulebyIDJson("40f027b5-24a9-4db7-b422-a963c9feeb7a");
+ vars = new LCMRulesExecutorVariables(aServiceSpec, new ServiceOrder(), null, aService, null, null, null);
+ vars = lcmRulesExecutor.executeLCMRuleCode( lcs, vars);
+ assertThat( vars.getCompileDiagnosticErrors().size() ).isEqualTo(0);
+
+ assertThat(
+ vars.getServiceToCreate().getServiceCharacteristic()
+ .stream()
+ .filter(c -> c.getName().equals("cirros_2vnf_ns::OSM_CONFIG"))
+ .findFirst().get().getValue().getValue()
+ ).contains("cccccccc-8219-4580-9697-bf4a8f0a08f9");
+
+
+ assertThat(
+ vars.getServiceToCreate().getServiceCharacteristic()
+ .stream()
+ .filter(c -> c.getName().equals("newvar"))
+ .findFirst().get().getValue().getValue()
+ ).contains("anewtestval");
+
+
+
+ lcs = scmocked.getLCMRulebyIDJson("75cebf16-1699-486f-8304-d6512f90c910");
+ vars = lcmRulesExecutor.executeLCMRuleCode( lcs, vars);
+
+
+ assertThat(
+ vars.getServiceToCreate().getServiceCharacteristic()
+ .stream()
+ .filter(c -> c.getName().equals("cirros_2vnf_ns::OSM_CONFIG"))
+ .findFirst().get().getValue().getValue()
+ ).contains("cccccccc-8219-4580-9697-bf4a8f0a08f9");
+ assertThat(
+ vars.getServiceToCreate().getServiceCharacteristic()
+ .stream()
+ .filter(c -> c.getName().equals("cirros_2vnf_ns::SSHKEY"))
+ .findFirst().get().getValue().getValue()
+ ).isEqualTo("MYKEYXExampleConcatSSHKEY_EnhancedByRule");
+
+
+ logger.debug("Will make web calls. This is made online.");
+
+// lcs = scmocked.getLCMRulebyIDJson("49e2e679-9dc1-4c7b-abd9-72377d4c1a5d");
+// vars = lcmRulesExecutor.executeLCMRuleCode( lcs, vars);//this includes a post
+
+ lcs = scmocked.getLCMRulebyIDJson("c1bd362d-011f-485b-a7d9-3bb05a2f6868");
+ vars = lcmRulesExecutor.executeLCMRuleCode( lcs, vars);// this includes a GET and payload json to service
+
+ logger.debug("===============TEST END testExecRuleSpec =============================");
+ }
+
+
+
+}
diff --git a/src/test/java/org/etsi/osl/osom/OrchestrationServiceMocked.java b/src/test/java/org/etsi/osl/osom/OrchestrationServiceMocked.java
new file mode 100644
index 0000000000000000000000000000000000000000..0e324d3faf997b7cb3527b2eda477fdf4fb0155c
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/OrchestrationServiceMocked.java
@@ -0,0 +1,46 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+import org.springframework.stereotype.Component;
+
+
+public class OrchestrationServiceMocked implements JavaDelegate {
+
+ private static final transient Log logger = LogFactory.getLog(OrchestrationServiceMocked.class.getName());
+
+ public void execute(DelegateExecution execution) {
+
+ logger.info("OrchestrationServiceMocked:" + execution.getVariableNames() );
+
+ if (execution.getVariable("orderid") instanceof String) {
+
+
+
+ logger.info("MOCKED Orchestration of order with id = " + execution.getVariable("orderid") + ". FINISHED!");
+ }
+ }
+
+}
diff --git a/src/test/java/org/etsi/osl/osom/ProcessOrderIntegrationTest.java b/src/test/java/org/etsi/osl/osom/ProcessOrderIntegrationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3a5c71602704de06a2caa0606bac4893c08a2b7f
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/ProcessOrderIntegrationTest.java
@@ -0,0 +1,388 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.lcm.LCMRulesExecutor;
+import org.etsi.osl.osom.lcm.LCMRulesExecutorVariables;
+import org.etsi.osl.osom.management.ServiceOrderManager;
+import org.flowable.dmn.api.DmnRepositoryService;
+import org.flowable.dmn.api.ExecuteDecisionBuilder;
+import org.flowable.dmn.engine.DmnEngine;
+import org.flowable.dmn.engine.test.DmnDeployment;
+import org.flowable.dmn.model.DmnDefinition;
+import org.flowable.dmn.xml.converter.DmnXMLConverter;
+import org.flowable.engine.RepositoryService;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.TaskService;
+import org.flowable.engine.runtime.ProcessInstance;
+import org.flowable.spring.impl.test.FlowableSpringExtension;
+import org.flowable.task.api.Task;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.common.model.EValueType;
+import org.etsi.osl.tmf.common.model.service.Characteristic;
+import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristicValue;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.sim638.model.Service;
+import org.etsi.osl.tmf.sim638.model.ServiceCreate;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import org.etsi.osl.tmf.so641.model.ServiceOrderItem;
+
+@ExtendWith(FlowableSpringExtension.class)
+@SpringBootTest(properties = { "CATALOG_GET_SERVICEORDER_BY_ID = direct:get_mocked_order",
+ "CATALOG_GET_SERVICESPEC_BY_ID = direct:get_mocked_spec", "CATALOG_ADD_SERVICE = direct:get_mocked_add_service",
+ "CATALOG_UPD_SERVICEORDER_BY_ID = direct:get_mocked_upd_order",
+ "CATALOG_ADD_SERVICEORDER = direct:get_mocked_upd_order",
+ "CATALOG_GET_SERVICE_BY_ID = direct:get_mocked_service_id",
+ "CATALOG_SERVICE_QUEUE_ITEMS_GET: direct:get_mocked_service_queueitems",
+ "CATALOG_SERVICE_QUEUE_ITEM_UPD: direct:get_mocked_service_id",
+ "CATALOG_SERVICE_QUEUE_ITEM_DELETE: direct:get_mocked_service_id",
+ "CATALOG_UPD_SERVICE = direct:get_mocked_upd_service",
+ "NFV_CATALOG_DEPLOY_NSD_REQ = direct:req_deploy_nsd",
+ "CATALOG_GET_LCMRULE_BY_ID = direct:get_mocked_lcmrulebyid",
+ "CATALOG_GET_LCMRULES_BY_SPECID_PHASE = direct:get_mocked_lcmrulesbyspecid",
+ "CATALOG_SERVICES_OF_PARTNERS = direct:get_mocked_service_queueitems",
+ "CATALOG_SERVICES_TO_TERMINATE = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICEORDER_IDS_BY_STATE = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICETESTSPEC_BY_ID = direct:get_mocked_service_queueitems",
+ "CATALOG_ADD_SERVICETEST = direct:get_mocked_service_queueitems",
+ "CATALOG_UPD_SERVICETEST = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICETEST_BY_ID = direct:get_mocked_service_queueitems",
+ "ALARMS_ADD_ALARM=mock:output",
+ "ALARMS_UPDATE_ALARM=mock:output",
+ "ALARMS_GET_ALARM=mock:output",
+ "NFV_CATALOG_GET_DEPLOYMENT_BY_ID = direct:req_deployment_id",
+ "NFV_CATALOG_UPD_DEPLOYMENT_BY_ID = direct:req_deployment_id",
+ "NFV_CATALOG_GET_NSD_BY_ID = direct:req_nsd_id",
+ "uri.to = mock:output" })
+@ActiveProfiles("testing")
+public class ProcessOrderIntegrationTest {
+ private static final transient Log logger = LogFactory.getLog(ProcessOrderIntegrationTest.class.getName());
+
+ @Autowired
+ RepositoryService repositoryService;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private TaskService taskService;
+
+ @Autowired
+ private CamelContext camelContext;
+
+ RoutesBuilder builder = new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:get_mocked_order").bean(scmocked, "getOrderById");
+ from("direct:get_mocked_spec").bean(scmocked, "getSpecById");
+ from("direct:get_mocked_add_service").bean(scmocked, "getMockedAddService");
+ from("direct:get_mocked_upd_service").bean(scmocked, "getMockedService");
+ from("direct:get_mocked_upd_order").bean(scmocked, "updateServiceOrder");
+ from("direct:get_mocked_service_id").bean(scmocked, "getServiceById");
+ from("direct:get_mocked_service_queueitems").bean(scmocked, "getServiceQueueItems");
+ from("direct:get_mocked_lcmrulebyid").bean(scmocked, "getLCMRulebyID");
+ from("direct:get_mocked_lcmrulesbyspecid").bean(scmocked, "getLCMRulesbySpecIDPhase(${header.servicespecid}, ${header.phasename})");
+ from("direct:req_deploy_nsd").bean(scmocked, "req_deploy_nsd");
+ from("direct:req_deployment_id").bean(scmocked, "req_deployment_id");
+ from("direct:req_nsd_id").bean(scmocked, "req_nsd_id");
+
+ };
+ };
+
+
+// @MockBean(name = "orchestrationService" )
+// @Autowired
+// private OrchestrationServiceMocked orchestrationServiceMocked;
+
+ @Autowired
+ private ServiceOrderManager serviceOrderManager;
+
+ SCMocked scmocked = new SCMocked();
+
+ @Test
+ // @Deployment(resources = { "processes/ServiceOrder.bpmn" })
+ public void startProcess() throws Exception {
+ logger.debug("===============TEST START startProcess =============================");
+ // doCallRealMethod().when( orchestrationServiceMocked).execute( Mockito.any() )
+ // ;
+
+ /**
+ * configure here the mocked routes
+ */
+
+ camelContext.addRoutes(builder);
+
+ logger.info("waiting 1secs");
+ Thread.sleep(1000); // wait
+ scmocked.getRunningServices().clear();
+ ServiceSpecification spec = serviceOrderManager.retrieveServiceSpec("f2b74f90-4140-4895-80d1-ef243398117b");
+ ServiceSpecification specCirros = serviceOrderManager.retrieveServiceSpec("99176116-17cf-464f-96f7-86e685914666");
+ ServiceOrder sorder = serviceOrderManager.retrieveServiceOrder("a842a6fd-a9df-4d0e-9e17-922954a100c6");
+ assertThat(sorder).isInstanceOf(ServiceOrder.class);
+ assertThat(spec).isInstanceOf(ServiceSpecification.class);
+
+ assertThat(spec.getServiceSpecCharacteristic().size() ).isEqualTo(11);
+ assertThat(specCirros.getServiceSpecCharacteristic().size() ).isEqualTo(10);
+ assertThat(sorder.getOrderItem().stream().findFirst().get().getService().getServiceCharacteristic().size() ).isEqualTo(2);
+
+ assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(14);
+ assertThat(taskService.createTaskQuery().count()).isEqualTo(0);
+
+ assertThat( scmocked.getRequeestedDescriptor() ).isNull();
+
+ repositoryService.suspendProcessDefinitionByKey("OrderSchedulerProcess"); // this is to stop the timer
+
+ Map variables = new HashMap<>();
+ variables.put("orderid", "a842a6fd-a9df-4d0e-9e17-922954a100c6");
+ runtimeService.startProcessInstanceByKey("StartOrderProcess", variables);
+ logger.info("waiting 10sec");
+ Thread.sleep(7000); // wait
+
+ for (ProcessInstance pi : runtimeService.createProcessInstanceQuery().list()) {
+ logger.info(" pi.id " + pi.toString());
+ }
+
+ for (Task task : taskService.createTaskQuery().list()) {
+ logger.info(" task.name " + task.getName());
+ }
+
+ if (scmocked.getRunningServices().size() <2) {
+ Thread.sleep(5000); // wait a little more :-)
+ }
+
+
+ //check here that the running services contain equal characteristics to the original
+ assertThat( scmocked.getRunningServices().size() ).isEqualTo(2);
+ Service aservice = null;
+ Service aserviceCirros = null;
+ for (String suuid : scmocked.getRunningServices().keySet()) {
+ if ( scmocked.getRunningServices().get( suuid ).getName().equals("Cirros Test") ){
+ aservice = scmocked.getRunningServices().get( suuid );
+ } else if ( scmocked.getRunningServices().get( suuid ).getName().equals("cirros_2vnf_ns") ){
+ aserviceCirros = scmocked.getRunningServices().get( suuid );
+ }
+ }
+ assertThat( aservice ).isNotNull();
+ assertThat( aservice.getServiceCharacteristic().size() ).isEqualTo(11);
+ assertThat( aserviceCirros ).isNotNull();
+ assertThat( aserviceCirros.getServiceCharacteristic().size() ).isEqualTo(10);
+
+ assertThat( aservice.getServiceCharacteristicByName("Quality Class").getValue().getValue() ).isEqualTo( "1" );
+ assertThat( aservice.getServiceCharacteristicByName("cirros_2vnf_ns::OSM_CONFIG").getValue().getValue() ).contains( "eeeeeeee-8219-4580-9697-bf4a8f0a08f9" );
+ assertThat( aservice.getServiceCharacteristicByName("cirros_2vnf_ns::SSHKEY").getValue().getValue() ).isEqualTo( "MCKEYTESTINORDERExampleConcatSSHKEY_EnhancedByRule" );
+ //check that the cirros_2vnf_ns::SSHKEY value from the service order has been passed properly to the related RFS service
+ assertThat( aserviceCirros.getServiceCharacteristicByName("OSM_CONFIG").getValue().getValue() ).contains( "eeeeeeee-8219-4580-9697-bf4a8f0a08f9" );
+ assertThat( aserviceCirros.getServiceCharacteristicByName("SSHKEY").getValue().getValue() ).isEqualTo( "MCKEYTESTINORDERExampleConcatSSHKEY_EnhancedByRule" );
+
+
+ //we will further check LCM rules!
+
+
+
+// assertThat( scmocked.getRequeestedDescriptor() ).isNotNull();
+// assertThat( scmocked.getRequeestedDescriptor().getId() ).isEqualTo( 123456789 );
+// assertThat( scmocked.getRequeestedDescriptor().getConfigStatus() ).contains("cirros_ue_uplink=192.0");
+// assertThat( scmocked.getRequeestedDescriptor().getConfigStatus() ).contains("cirros_slice_uplink=1024.0");
+
+
+
+ assertThat(taskService.createTaskQuery().count()).isEqualTo(0);
+
+ logger.info("waiting 3secs");
+ Thread.sleep(3000); // wait
+
+ logger.debug("===============TEST END startProcess =============================");
+ }
+
+ @Autowired
+ private DmnEngine dmnEngine;
+
+// @Autowired
+// private DmnRuleService ruleService;
+
+// @Autowired
+// @Rule
+// public FlowableDmnRule flowableSpringRule;
+//
+// @Test
+// @DmnDeployment(resources = "dmn/genericdecisions.dmn")
+// public void uniqueHitPolicy() {
+// logger.debug("===============TEST START uniqueHitPolicy =============================");
+//// DmnEngine admnEngine = flowableSpringRule.getDmnEngine();
+// DmnRuleService dmnRuleService = dmnEngine.getDmnRuleService();
+//
+// ExecuteDecisionBuilder ex = ruleService.createExecuteDecisionBuilder().decisionKey("decisionKJ");
+//
+// Map result = ex.variable("Uplink_throughput_per_UE__Guaranteed_uplink_throughput", 8).executeWithSingleResult();
+//
+// assertEquals(64.0, result.get("cirros_ue_uplink"));
+// assertEquals(512.0, result.get("cirros_slice_uplink"));
+// logger.debug("===============TEST END uniqueHitPolicy =============================");
+// }
+
+ @Test
+ public void programmaticallyCreate() throws XMLStreamException, FileNotFoundException {
+
+ logger.debug("===============TEST START programmaticallyCreate =============================");
+ try {
+
+ File initialFile = new File("src/test/resources/ondemand_decisions.dmn");
+ InputStream targetStream = new FileInputStream(initialFile);
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader xtr = inputFactory.createXMLStreamReader(targetStream);
+ DmnDefinition dmnDefinition = new DmnXMLConverter().convertToDmnModel(xtr);
+
+ DmnRepositoryService dmnRepositoryService = dmnEngine.getDmnRepositoryService();
+ org.flowable.dmn.api.DmnDeployment dmnDeployment = dmnRepositoryService.createDeployment()
+ .name("decision_ONDEMAND").tenantId("abcd").addDmnModel("ondemand_decisions.dmn", dmnDefinition).deploy();
+
+// DmnDecisionTable dmnt = dmnRepositoryService.getDecisionTable( "decision_ONDEMAND" );
+// assertNotNull(dmnt);
+
+// ExecuteDecisionBuilder ex = ruleService.createExecuteDecisionBuilder().decisionKey("decision_ONDEMAND").tenantId("abcd");
+//
+// Map variables = new HashMap<>();
+// variables.put("cameras", 3);
+// variables.put("video_definition", 3);
+// Map result = ex.variables(variables).executeWithSingleResult();
+// assertEquals("1024", result.get("uplink"));
+// assertEquals( 2048.0, result.get("slice_uplink"));
+//
+// variables = new HashMap<>();
+// variables.put("cameras", 3);
+// variables.put("video_definition", 2);
+// result = ex.variables(variables).executeWithSingleResult();
+// assertEquals("256", result.get("uplink"));
+// assertEquals( 1024.0, result.get("slice_uplink"));
+
+
+ } finally {
+
+ }
+
+
+ logger.debug("===============TEST END programmaticallyCreate =============================");
+ }
+
+
+ @Test
+ public void testNFVOProcessOrder() throws Exception {
+
+ logger.debug("===============TEST START testNFVOProcessOrder =============================");
+
+// repositoryService.suspendProcessDefinitionByKey("OrderSchedulerProcess"); // this is to stop the timer
+ repositoryService.suspendProcessDefinitionByKey("fetchInRpogressOrdersProcess"); // this is to stop the timer
+
+
+// /**
+// * configure here the mocked routes
+// */
+// RoutesBuilder builder = new RouteBuilder() {
+// @Override
+// public void configure() {
+// from("direct:get_mocked_order").bean(scmocked, "getOrderById");
+// from("direct:get_mocked_spec").bean(scmocked, "getSpecById");
+// from("direct:get_mocked_add_service").bean(scmocked, "getMockedService");
+// from("direct:get_mocked_upd_service").bean(scmocked, "getMockedService");
+// from("direct:get_mocked_upd_order").bean(scmocked, "updateServiceOrder");
+// from("direct:get_mocked_service_id").bean(scmocked, "getServiceById");
+// from("direct:req_deploy_nsd").bean(scmocked, "req_deploy_nsd");
+// from("direct:req_deployment_id").bean(scmocked, "req_deployment_id");
+//
+// };
+// };
+//
+// camelContext.addRoutes(builder);
+
+ logger.info("waiting 1secs");
+ Thread.sleep(1000); // wait
+
+ assertThat(serviceOrderManager.retrieveServiceOrder("a842a6fd-a9df-4d0e-9e17-922954a100c6"))
+ .isInstanceOf(ServiceOrder.class);
+
+ Map variables = new HashMap<>();
+ variables.put("orderid", "a842a6fd-a9df-4d0e-9e17-922954a100c6");
+ runtimeService.startProcessInstanceByKey("StartOrderProcess", variables);
+ logger.info("waiting 1sec");
+ Thread.sleep(1000); // wait
+
+ for (ProcessInstance pi : runtimeService.createProcessInstanceQuery().list()) {
+ logger.info(" pi.id " + pi.toString());
+ }
+
+ for (Task task : taskService.createTaskQuery().list()) {
+ logger.info(" task.name " + task.getName());
+ }
+
+
+ logger.info("waiting 10secs");
+ Thread.sleep(10000); // wait
+
+ logger.debug("===============TEST END testNFVOProcessOrder =============================");
+ }
+
+
+
+
+
+}
diff --git a/src/test/java/org/etsi/osl/osom/ProcessPartnerServicesIntegrationTest.java b/src/test/java/org/etsi/osl/osom/ProcessPartnerServicesIntegrationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..5021eb0afdb1bd8a796c196926276b91938413c8
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/ProcessPartnerServicesIntegrationTest.java
@@ -0,0 +1,178 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.etsi.osl.osom.partnerservices.PartnerOrganizationServicesManager;
+import org.flowable.engine.ManagementService;
+import org.flowable.engine.RepositoryService;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.TaskService;
+import org.flowable.job.api.Job;
+import org.flowable.spring.impl.test.FlowableSpringExtension;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.etsi.osl.tmf.pm632.model.Organization;
+
+@ExtendWith(FlowableSpringExtension.class)
+@SpringBootTest(properties = { "CATALOG_GET_SERVICEORDER_BY_ID = direct:get_mocked_order",
+ "CATALOG_GET_SERVICESPEC_BY_ID = direct:get_mocked_spec", "CATALOG_ADD_SERVICE = direct:get_mocked_add_service",
+ "CATALOG_UPD_SERVICEORDER_BY_ID = direct:get_mocked_upd_order",
+ "CATALOG_ADD_SERVICEORDER = direct:get_mocked_upd_order",
+ "CATALOG_GET_SERVICE_BY_ID = direct:get_mocked_service_id",
+ "CATALOG_GET_SERVICE_BY_ORDERID = direct:get_mocked_service_id",
+ "CATALOG_SERVICE_QUEUE_ITEMS_GET: direct:get_mocked_service_id",
+ "CATALOG_SERVICE_QUEUE_ITEM_UPD: direct:get_mocked_service_id",
+ "CATALOG_SERVICE_QUEUE_ITEM_DELETE: direct:get_mocked_service_id",
+ "CATALOG_UPD_SERVICE = direct:get_mocked_upd_service", "NFV_CATALOG_DEPLOY_NSD_REQ = direct:req_deploy_nsd",
+ "NFV_CATALOG_GET_DEPLOYMENT_BY_ID = direct:req_deployment_id",
+ "NFV_CATALOG_UPD_DEPLOYMENT_BY_ID = direct:req_deployment_id",
+ "CATALOG_GET_EXTERNAL_SERVICE_PARTNERS = direct:get_mocked_partners",
+ "CATALOG_UPD_EXTERNAL_SERVICESPEC = direct:upd_external_specs",
+ "CATALOG_GET_SERVICETESTSPEC_BY_ID = direct:get_mocked_service_queueitems",
+ "CATALOG_ADD_SERVICETEST = direct:get_mocked_service_queueitems",
+ "CATALOG_UPD_SERVICETEST = direct:get_mocked_service_queueitems",
+ "CATALOG_GET_SERVICETEST_BY_ID = direct:get_mocked_service_queueitems",
+
+
+ "uri.to = mock:output" })
+@ActiveProfiles("testing")
+public class ProcessPartnerServicesIntegrationTest {
+ private static final transient Log logger = LogFactory.getLog(ProcessPartnerServicesIntegrationTest.class.getName());
+
+ @Autowired
+ RepositoryService repositoryService;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+
+ @Autowired
+ private ManagementService managementService;
+
+ @Autowired
+ private TaskService taskService;
+
+ @Autowired
+ private CamelContext camelContext;
+
+ @Autowired
+ private PartnerOrganizationServicesManager partnerOrganizationServicesManager;
+
+ SPMocked spmocked = new SPMocked();
+
+ @Test
+ // @Deployment(resources = { "processes/ServiceOrder.bpmn" })
+ public void startProcess() throws Exception {
+
+
+// repositoryService.suspendProcessDefinitionByKey("OrderSchedulerProcess"); // this is to stop the timer
+// repositoryService.suspendProcessDefinitionByKey("fetchInRpogressOrdersProcess"); // this is to stop the timer
+ //repositoryService.suspendProcessDefinitionByKey("fetchPartnerServicesProcess"); // this is to stop the timer
+
+ /**
+ * configure here the mocked routes
+ */
+ RoutesBuilder builder = new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:get_mocked_partners").bean(spmocked, "getPartners");
+ from("direct:upd_external_specs").bean(spmocked, "updateExternalSpecs");
+
+ };
+ };
+
+ camelContext.addRoutes(builder);
+
+ logger.info("waiting 1secs");
+ Thread.sleep(1000); // wait
+
+ List orgz = partnerOrganizationServicesManager.retrievePartners();
+ assertThat( orgz ).isInstanceOf( List.class);
+
+ assertThat( orgz ).hasSize(1);
+ assertThat( orgz.get(0).getPartyCharacteristic() ).hasSize(11);
+ assertThat( orgz.get(0).findPartyCharacteristic("EXTERNAL_TMFAPI_BASEURL").getValue().getValue() ).isEqualTo( "http://portal.openslice.io" );
+
+
+ //{"OAUTH2CLIENTSECRET":"secret","OAUTH2TOKENURI":"http://portal.openslice.io/osapi-oauth-server/oauth/token","OAUTH2SCOPES":["admin","read"],"PASSWORD":"openslice","BASEURL":"http://portal.openslice.io","USERNAME":"admin","CLIENTREGISTRATIONID":"authOpensliceProvider","OAUTH2CLIENTID":"osapiWebClientId"}
+// String strapiparams = orgz.get(0).getPartyCharacteristic().stream().findFirst().get().getValue().getValue();
+//
+// ObjectMapper mapper = new ObjectMapper();
+// mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+// Map apiparams = mapper.readValue(strapiparams, Map.class);
+//
+// assertThat( apiparams ).hasSize( 8 );
+// assertThat( apiparams.get("CLIENTREGISTRATIONID")).isEqualTo("authOpensliceProvider");
+// assertThat( apiparams.get("OAUTH2SCOPES")).isInstanceOf( ArrayList.class );
+// assertThat( (ArrayList) apiparams.get("OAUTH2SCOPES")).hasSize( 2 );
+
+ //Job timer = managementService.createTimerJobQuery().jobId("timerstarteventFetchPartnerServices").singleResult();
+ //repositoryService.activateProcessDefinitionByKey( "fetchPartnerServicesProcess" );
+ //runtimeService.startProcessInstanceById("fetchPartnerServicesProcess" );
+
+
+
+ List jobs = managementService.createTimerJobQuery().list();
+ logger.info( "jobs.size() " + jobs.size());
+ for (Job timer : jobs) {
+ logger.info( "Timer getExecutionId " + timer.getExecutionId() );
+ logger.info( "Timer getId " + timer.getId() );
+ logger.info( "Timer getJobHandlerConfiguration " + timer.getJobHandlerConfiguration() );
+ logger.info( "Timer getElementName " + timer.getElementName() );
+ if ( timer.getJobHandlerConfiguration().contains( "timerstarteventFetchPartnerServices" ) ) {
+ managementService.moveTimerToExecutableJob(timer.getId());
+ //managementService.executeJob(timer.getId());
+
+ }
+ //logger.info( "Timer details" + runtimeService.getActiveActivityIds( timer.getId() ));
+ }
+
+
+
+ logger.info("waiting 20secs");
+ Thread.sleep( 20000 ); // wait
+
+ /**
+ * this one needs to be online.. not fully mocked yet
+ */
+
+ //assertThat( spmocked.getUpdatedSpecs() ).hasSize(25);
+ }
+
+
+
+}
diff --git a/src/test/java/org/etsi/osl/osom/SCMocked.java b/src/test/java/org/etsi/osl/osom/SCMocked.java
new file mode 100644
index 0000000000000000000000000000000000000000..f114c8bbb7c14775f06e71a202c713ce91d6e4ac
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/SCMocked.java
@@ -0,0 +1,326 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.model.DeploymentDescriptorStatus;
+import org.etsi.osl.model.NetworkServiceDescriptor;
+import org.etsi.osl.tmf.lcm.model.LCMRuleSpecification;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+import jakarta.validation.Valid;
+
+public class SCMocked {
+
+
+ private static final transient Log logger = LogFactory.getLog(SCMocked.class.getName());
+
+
+ private static Map runningServices = new HashMap<>();
+
+
+ private DeploymentDescriptor requeestedDescriptor;
+
+ /**
+ * get mocked service order by id from model via bus
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public String getOrderById(String id) throws IOException {
+ logger.info( "getOrderById id= " + id );
+ File sspec = new File( "src/test/resources/TestExServiceOrder.json" );
+ InputStream in = new FileInputStream( sspec );
+ String sspectext = IOUtils.toString(in, "UTF-8");
+
+ return sspectext;
+ }
+
+
+
+ /**
+ *
+ * get mocked service spec by id from model via bus
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public String getSpecById(String id) throws IOException {
+
+ logger.info( "getSpecById id= " + id );
+ String sspectext = null;
+ if ( id.equals( "f2b74f90-4140-4895-80d1-ef243398117b" )) {
+ File sspec = new File( "src/test/resources/TestExBundleSpec.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "59d08753-e1b1-418b-9e3e-d3a3bb573051" )) {
+ File sspec = new File( "src/test/resources/TestExSpec1.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "a7ff2349-ccab-42a1-9212-51d4a1912247" )) {
+ File sspec = new File( "src/test/resources/TestExSpec2.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "0d5551e6-069f-43b7-aa71-10530f290239" )) {
+ File sspec = new File( "src/test/resources/TestExSpec3.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "93b9928c-de35-4495-a157-1100f6e71c92" )) {
+ File sspec = new File( "src/test/resources/TestServiceOrderDates.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "c00446ac-c8af-47ad-ac94-518d4bdd4c13" )) {
+ File sspec = new File( "src/test/resources/TestServiceNSD.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "22e399d3-b152-4966-9d0f-20e5b2ec42c4" )) {
+ File sspec = new File( "src/test/resources/NFVO_Example_RFS.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "0399516f-e9ae-4c8e-8f7a-b13ad9a1bd00" )) {
+ File sspec = new File( "src/test/resources/NFVO_Example.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ } else if ( id.equals( "99176116-17cf-464f-96f7-86e685914666" )) {
+ File sspec = new File( "src/test/resources/cirros_2vnf_ns_RFS.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ }
+
+
+
+ return sspectext;
+ }
+
+ public String getMockedService() throws IOException {
+ logger.info( "getMockedService()" );
+
+ String sspectext = null;
+
+ File sspec = new File( "src/test/resources/TestService.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+ }
+
+
+ public String getMockedAddService(@Valid String aservice) throws IOException {
+ //normally this is a ServiceCreate
+
+ org.etsi.osl.tmf.sim638.model.Service serviceInstance = toJsonObj( (String)aservice, org.etsi.osl.tmf.sim638.model.Service.class);
+
+ logger.info( "getMockedAddService() service name: " + serviceInstance.getName() );
+
+ serviceInstance.setUuid( UUID.randomUUID().toString() );
+
+ runningServices.put(serviceInstance.getUuid() , serviceInstance);
+ logger.info( "getMockedAddService() runningServices.sizes: " + runningServices.size() );
+
+ String sspectext = null;
+
+ sspectext = toJsonString(serviceInstance);
+ return sspectext;
+ }
+
+
+ public String updateServiceOrder(String so) throws IOException {
+
+ logger.info( "updateServiceOrder so= " + so );
+
+ ServiceOrder sorder = toJsonObj(so, ServiceOrder.class);
+
+
+ String sspectext = null;
+//
+// File sspec = new File( "src/test/resources/TestService.json" );
+// InputStream in = new FileInputStream( sspec );
+// sspectext = IOUtils.toString(in, "UTF-8");
+
+ sspectext = toJsonString(sorder);
+ return sspectext;
+ }
+
+
+ public String getServiceById(String id) throws IOException {
+
+ logger.info( "getServiceById id = " + id );
+
+ String sspectext = null;
+
+ if ( runningServices.get(id) != null ) {
+ org.etsi.osl.tmf.sim638.model.Service serviceInstance = runningServices.get(id);
+ sspectext = toJsonString(serviceInstance);
+ return sspectext;
+ }
+
+
+ File sspec = new File( "src/test/resources/TestService.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+ }
+
+ public String getLCMRulebyID(String id) throws IOException {
+ logger.info( "getLCMRulebyID id = " + id );
+
+ String sspectext = null;
+
+ if ( id.equals("40f027b5-24a9-4db7-b422-a963c9feeb7a") ) {
+ File sspec = new File( "src/test/resources/LcmCirrosRule1Test.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+ }else if ( id.equals("75cebf16-1699-486f-8304-d6512f90c910") ) {
+ File sspec = new File( "src/test/resources/LcmCirrosRule2Test.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+ } else if ( id.equals("8b7b8339-0c33-4731-af9c-c98adadbe777") ) {
+ File sspec = new File( "src/test/resources/LcmCirrosRule3Test.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+
+ } else if ( id.equals("49e2e679-9dc1-4c7b-abd9-72377d4c1a5d") ) {
+ File sspec = new File( "src/test/resources/LcmRule4Test.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+ } else if ( id.equals("c1bd362d-011f-485b-a7d9-3bb05a2f6868") ) {
+ File sspec = new File( "src/test/resources/LcmRule5Test.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+ }
+
+
+
+
+ return "";
+ }
+
+ public LCMRuleSpecification getLCMRulebyIDJson(String id) throws IOException {
+ String s = getLCMRulebyID( id);
+
+ return toJsonObj(s, LCMRuleSpecification.class);
+ }
+
+ public String getLCMRulesbySpecIDPhase(String specid, String phaseName) throws IOException {
+ logger.info( "getLCMRulesbySpecIDPhase specid = " + specid );
+
+ String sspectext = null;
+
+ if ( specid.equals("f2b74f90-4140-4895-80d1-ef243398117b") ) {
+ File sspec = new File( "src/test/resources/LcmRuleListSpecTest.json" );
+ InputStream in = new FileInputStream( sspec );
+ sspectext = IOUtils.toString(in, "UTF-8");
+ return sspectext;
+
+ }
+
+
+ return "[]";
+ }
+
+ public String req_deploy_nsd( String ddreq ) throws IOException {
+
+ logger.info( "ddreq getExperiment = " + toJsonString(ddreq) );
+
+ DeploymentDescriptor ddresp = toJsonObj( ddreq, DeploymentDescriptor.class);
+ ddresp.setId(123456789);
+ setRequeestedDescriptor(ddresp);
+ return toJsonString(ddresp);
+ }
+
+
+ public String req_deployment_id( Long ddreqId ) throws IOException {
+
+ logger.info( "ddreq get id = " + ddreqId );
+
+ DeploymentDescriptor ddresp = new DeploymentDescriptor();
+ ddresp.setId(ddreqId);
+ ddresp.setStatus( DeploymentDescriptorStatus.RUNNING );
+ return toJsonString(ddresp);
+ }
+
+
+ public String req_nsd_id( Long ddreqId ) throws IOException {
+
+ logger.info( "req_nsd_id = " + ddreqId );
+
+ NetworkServiceDescriptor sor = new NetworkServiceDescriptor();
+ sor.setId(ddreqId);
+ return toJsonString(sor);
+ }
+
+ public String getServiceQueueItems() throws IOException {
+ return "[]";
+ }
+
+ static String toJsonString(Object object) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.writeValueAsString(object);
+ }
+
+ static T toJsonObj(String content, Class valueType) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.readValue( content, valueType);
+ }
+
+
+
+ public DeploymentDescriptor getRequeestedDescriptor() {
+ return requeestedDescriptor;
+ }
+
+
+
+ public void setRequeestedDescriptor(DeploymentDescriptor requeestedDescriptor) {
+ this.requeestedDescriptor = requeestedDescriptor;
+ }
+
+
+
+ /**
+ * @return the runningServices
+ */
+ public Map getRunningServices() {
+ return runningServices;
+ }
+
+
+
+}
diff --git a/src/test/java/org/etsi/osl/osom/SPMocked.java b/src/test/java/org/etsi/osl/osom/SPMocked.java
new file mode 100644
index 0000000000000000000000000000000000000000..0220ebab835a24e8b5c24e3142eb29d52ee0964f
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/SPMocked.java
@@ -0,0 +1,185 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.etsi.osl.model.DeploymentDescriptor;
+import org.etsi.osl.model.DeploymentDescriptorStatus;
+import org.etsi.osl.tmf.common.model.Any;
+import org.etsi.osl.tmf.pm632.model.Characteristic;
+import org.etsi.osl.tmf.pm632.model.ContactMedium;
+import org.etsi.osl.tmf.pm632.model.Organization;
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+import org.etsi.osl.tmf.so641.model.ServiceOrder;
+
+public class SPMocked {
+
+ private static final transient Log logger = LogFactory.getLog(SPMocked.class.getName());
+
+
+ private List updatedSpecs = new ArrayList<>();
+ /**
+ * get mocked service order by id from model via bus
+ *
+ * @param id
+ * @return
+ * @throws IOException
+ */
+ public String getPartners() throws IOException {
+ logger.info("getPartners id ");
+
+ List alist= new ArrayList<>();
+ Organization oc = new Organization();
+ oc.setUuid(UUID.randomUUID().toString());
+ oc.setName("TESTA");
+
+// Characteristic partyCharacteristicItem = new Characteristic();
+// partyCharacteristicItem.setName( "EXTERNAL_TMFAPI" );
+//
+// Any value = new Any();
+//
+// Map apiparams = new HashMap<>();
+// String[] scopes = {"admin" , "read"};
+//
+//
+// apiparams.put( "CLIENTREGISTRATIONID", "authOpensliceProvider");
+// apiparams.put( "OAUTH2CLIENTID", "osapiWebClientId");
+// apiparams.put( "OAUTH2CLIENTSECRET", "secret");
+// apiparams.put( "OAUTH2SCOPES", scopes);
+// apiparams.put( "OAUTH2TOKENURI", "http://portal.openslice.io/osapi-oauth-server/oauth/token");
+// apiparams.put( "USERNAME", "admin");
+// apiparams.put( "PASSWORD", "openslice");
+// apiparams.put( "BASEURL", "http://portal.openslice.io");
+//
+// ObjectMapper mapper = new ObjectMapper();
+// mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+// String strinparams = mapper.writeValueAsString( apiparams );
+// value.setValue( strinparams );
+//
+// partyCharacteristicItem.setValue( value );
+// o.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ Characteristic partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_BASEURL");
+ partyCharacteristicItem.value( new Any( "http://portal.openslice.io" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_CLIENTREGISTRATIONID");
+ partyCharacteristicItem.value( new Any( "authOpensliceProvider" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_OAUTH2CLIENTID");
+ partyCharacteristicItem.value( new Any( "osapiWebClientId" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_OAUTH2CLIENTSECRET");
+ partyCharacteristicItem.value( new Any( "secret" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_OAUTH2SCOPES");
+ partyCharacteristicItem.value( new Any( "admin;read" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_OAUTH2TOKENURI");
+ partyCharacteristicItem.value( new Any( "http://portal.openslice.io/osapi-oauth-server/oauth/token" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_USERNAME");
+ partyCharacteristicItem.value( new Any( "admin" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_PASSWORD");
+ partyCharacteristicItem.value( new Any( "openslice" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_SERVICE_CATALOG_URLS");
+ partyCharacteristicItem.value( new Any( "" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_SERVICE_CATEGORY_URLS");
+ partyCharacteristicItem.value( new Any( "" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+
+ partyCharacteristicItem = new Characteristic();
+ partyCharacteristicItem.setName("EXTERNAL_TMFAPI_SERVICE_ORDER_URLS");
+ partyCharacteristicItem.value( new Any( "" ));
+ oc.addPartyCharacteristicItem(partyCharacteristicItem );
+
+
+ alist.add( oc );
+ return toJsonString(alist);
+ }
+
+ public String updateExternalSpecs( String s) throws IOException {
+ ServiceSpecification spec = toJsonObj(s, ServiceSpecification.class );
+ logger.info("updateExternalSpecs spec id= " + spec.getId() );
+ updatedSpecs.add( spec );
+ return toJsonString( spec );
+
+ }
+
+ static String toJsonString(Object object) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.writeValueAsString(object);
+ }
+
+ static T toJsonObj(String content, Class valueType) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper.readValue(content, valueType);
+ }
+
+ public List getUpdatedSpecs() {
+ return updatedSpecs;
+ }
+
+ public void setUpdatedSpecs(List updatedSpecs) {
+ this.updatedSpecs = updatedSpecs;
+ }
+
+
+}
diff --git a/src/test/java/org/etsi/osl/osom/SystemTaskMocked.java b/src/test/java/org/etsi/osl/osom/SystemTaskMocked.java
new file mode 100644
index 0000000000000000000000000000000000000000..63a5347e9d9460d6b1e41394fc1f387a62a54d26
--- /dev/null
+++ b/src/test/java/org/etsi/osl/osom/SystemTaskMocked.java
@@ -0,0 +1,35 @@
+/*-
+ * ========================LICENSE_START=================================
+ * org.etsi.osl.osom
+ * %%
+ * 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.osom;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.JavaDelegate;
+
+public class SystemTaskMocked implements JavaDelegate {
+
+
+ private static final transient Log logger = LogFactory.getLog( SystemTaskMocked.class.getName());
+
+ public void execute(DelegateExecution execution) {
+ logger.info("MOCKED, from systemTaskMocked ");
+ }
+}
diff --git a/src/test/resources/LcmCirrosRule1Test.json b/src/test/resources/LcmCirrosRule1Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..321dff32cdfb787110a6e99f71f6337b7d1f95ca
--- /dev/null
+++ b/src/test/resources/LcmCirrosRule1Test.json
@@ -0,0 +1,30 @@
+{
+ "uuid": "40f027b5-24a9-4db7-b422-a963c9feeb7a",
+ "lastUpdate": null,
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "BaseEntity",
+ "href": null,
+ "name": "OSM config depending on class",
+ "description": "LCM Rule for specification Cirros Test OSM config depending on class",
+ "lifecycleStatus": "In study",
+ "version": null,
+ "validFor": null,
+ "id": "40f027b5-24a9-4db7-b422-a963c9feeb7a",
+ "lcmrulephase": "PRE_PROVISION",
+ "content": "EQ Quality Class 2 cirros_2vnf_ns::OSM_CONFIG 0b6853fc-8219-4580-9697-bf4a8f0a08f9 c224eb48-419e-4097-8a1d-11ec1bba087f EQ Quality Class 1 cirros_2vnf_ns::OSM_CONFIG eeeeeeee-8219-4580-9697-bf4a8f0a08f9 eeeeeeee-419e-4097-8a1d-11ec1bba087f cirros_2vnf_ns::OSM_CONFIG cccccccc-8219-4580-9697-bf4a8f0a08f9 cccccccc-419e-4097-8a1d-11ec1bba087f ",
+ "code": "if (getCharValNumber(\"Quality Class\") == 2) {\n setCharValFromStringType(\"cirros_2vnf_ns::OSM_CONFIG\", \"\"\"\n {\n \"nsdId\": \"0b6853fc-8219-4580-9697-bf4a8f0a08f9\",\n \"vimAccountId\": \"c224eb48-419e-4097-8a1d-11ec1bba087f\"\n }\n \"\"\");\n} else if (getCharValNumber(\"Quality Class\") == 1) {\n setCharValFromStringType(\"cirros_2vnf_ns::OSM_CONFIG\", \"\"\"\n {\n \"nsdId\": \"eeeeeeee-8219-4580-9697-bf4a8f0a08f9\",\n \"vimAccountId\": \"eeeeeeee-419e-4097-8a1d-11ec1bba087f\"\n }\n \"\"\");\n} else {\n setCharValFromStringType(\"cirros_2vnf_ns::OSM_CONFIG\", \"\"\"\n {\n \"nsdId\": \"cccccccc-8219-4580-9697-bf4a8f0a08f9\",\n \"vimAccountId\": \"cccccccc-419e-4097-8a1d-11ec1bba087f\"\n }\n \"\"\"); setCharValFromStringType(\"newvar\", \"anewtestval\"); \n}\n",
+ "serviceSpecs": [
+ {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Cirros Test",
+ "version": null,
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "f2b74f90-4140-4895-80d1-ef243398117b"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/test/resources/LcmCirrosRule2Test.json b/src/test/resources/LcmCirrosRule2Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..c461f1f8aefaf4777304665f03ad98f3f981c599
--- /dev/null
+++ b/src/test/resources/LcmCirrosRule2Test.json
@@ -0,0 +1,30 @@
+{
+ "uuid": "75cebf16-1699-486f-8304-d6512f90c910",
+ "lastUpdate": null,
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "BaseEntity",
+ "href": null,
+ "name": "LCM Rule Cirros Test rule2",
+ "description": "LCM Rule for specification Cirros Test rule 2 example",
+ "lifecycleStatus": "In study",
+ "version": null,
+ "validFor": null,
+ "id": "75cebf16-1699-486f-8304-d6512f90c910",
+ "lcmrulephase": "PRE_PROVISION",
+ "content": "cirros_2vnf_ns::SSHKEY cirros_2vnf_ns::SSHKEY ExampleConcatSSHKEY_EnhancedByRule ",
+ "code": "setCharValFromStringType(\"cirros_2vnf_ns::SSHKEY\", getCharValFromStringType(\"cirros_2vnf_ns::SSHKEY\")+\"ExampleConcatSSHKEY_EnhancedByRule\");\n",
+ "serviceSpecs": [
+ {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Cirros Test",
+ "version": null,
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "f2b74f90-4140-4895-80d1-ef243398117b"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/test/resources/LcmCirrosRule3Test.json b/src/test/resources/LcmCirrosRule3Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..278cdaaa7ce8994ba683bb604e141a8a20904c36
--- /dev/null
+++ b/src/test/resources/LcmCirrosRule3Test.json
@@ -0,0 +1,31 @@
+{
+ "uuid": "8b7b8339-0c33-4731-af9c-c98adadbe777",
+ "lastUpdate": null,
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "BaseEntity",
+ "href": null,
+ "name": "LCM Rule Upstream journalist case",
+ "description": "LCM Rule for specification Upstream journalist case",
+ "lifecycleStatus": "In study",
+ "version": null,
+ "validFor": null,
+ "id": "8b7b8339-0c33-4731-af9c-c98adadbe777",
+ "lcmrulephase": "PRE_PROVISION",
+ "content": "param3 configutationPrimitive i strTargetsParam strOsmConfig3 param3 Number of reserved hours Open5GCore-2enb_nsd::nsName myNsNAME configutationPrimitive { \"tvg\": { \"ip\": \"\", \"channel1\": { \"mode\": \"0\" } } } Number of reserved hours 24 i Number of reserved hours Maximum Number of cameras 16 cirros_2vnf_nsd::Primitive::fsetup member_vnf_index 1 primitive fsetup confjson configutationPrimitive strTargetsParam 172.16.10.203,172.16.10.205,192.168.101.101 strOsmConfig3 { \"nsdId\": \"59065615-9b6b-4344-8432-1eb7975a37e7\", \"vimAccountId\": \"eb0db325-6cc0-4763-813e-0d06ff754a4e\", \"vnf\": [ { \"member-vnf-index\": \"1\", \"vdu\": [ { \"id\": \"PrometheusCharmedVNF-VM\", \"interface\": [ { \"name\": \"eth0\", \"floating-ip-required\": true } ] } ] } ], \"vld\": [ { \"name\": \"public\", \"vim-network-name\": \"OSMFIVE_selfservice01\" }, { \"name\": \"network1\", \"vim-network-name\": \"provider10_vlan401\" }, { \"name\": \"network2\", \"vim-network-name\": \"provider10_vlan1000\" }, { \"name\": \"network3\", \"ip-profile\": { \"ip-version\": \"ipv4\", \"subnet-address\": \"192.168.101.0/24\", \"gateway-address\": \"0.0.0.0\", \"dns-server\": [ { \"address\": \"8.8.8.8\" } ], \"dhcp-params\": { \"enabled\": true } }, \"vnfd-connection-point-ref\": [ { \"member-vnf-index-ref\": \"1\", \"vnfd-connection-point-ref\": \"vnf-cp3\", \"ip-address\": \"192.168.101.100\" } ] }, { \"name\": \"network4\", \"ip-profile\": { \"ip-version\": \"ipv4\", \"subnet-address\": \"192.168.102.0/24\", \"gateway-address\": \"0.0.0.0\", \"dns-server\": [ { \"address\": \"8.8.8.8\" } ], \"dhcp-params\": { \"enabled\": true } }, \"vnfd-connection-point-ref\": [ { \"member-vnf-index-ref\": \"1\", \"vnfd-connection-point-ref\": \"vnf-cp4\", \"ip-address\": \"192.168.102.100\" } ] }, { \"name\": \"network5\", \"ip-profile\": { \"ip-version\": \"ipv4\", \"subnet-address\": \"192.168.103.0/24\", \"gateway-address\": \"0.0.0.0\", \"dns-server\": [ { \"address\": \"8.8.8.8\" } ], \"dhcp-params\": { \"enabled\": true } }, \"vnfd-connection-point-ref\": [ { \"member-vnf-index-ref\": \"1\", \"vnfd-connection-point-ref\": \"vnf-cp5\", \"ip-address\": \"192.168.103.100\" } ] } ], \"additionalParamsForVnf\": [ { \"member-vnf-index\": \"1\", \"additionalParams\": { \"Targets\": \" strTargetsParam \" } } ] } EQ Video quality of the mobile cameras 3 Maximum Number of cameras 8 Open5GCore-2enb_nsd::OSM_CONFIG 59065615-9b6b-4344-8432-1eb7975a37e7 eb0db325-6cc0-4763-813e-0d06ff754a4e 1 [ { \"id\": \"PrometheusCharmedVNF-VM\", \"interface\": [ { \"name\": \"eth0\", \"floating-ip-required\": true } ] } ] public OSMFIVE_selfservice01 network1 provider10_vlan401 { \"name\": \"network3\", \"ip-profile\": { \"ip-version\": \"ipv4\", \"subnet-address\": \"192.168.101.0/24\", \"gateway-address\": \"0.0.0.0\", \"dns-server\": [ { \"address\": \"8.8.8.8\" } ], \"dhcp-params\": { \"enabled\": true } }, \"vnfd-connection-point-ref\": [ { \"member-vnf-index-ref\": \"1\", \"vnfd-connection-point-ref\": \"vnf-cp3\", \"ip-address\": \"192.168.101.100\" } ] } 1 Target1Hours i Target2 55555 Target3MaxCameras Maximum Number of cameras EQ Video quality of the mobile cameras 2 Maximum Number of cameras 20 Open5GCore-2enb_nsd::OSM_CONFIG { \"nsdId\": \"59065615-9b6b-4344-8432-1eb7975a37e7\", \"vimAccountId\": \"eb0db325-6cc0-4763-813e-0d06ff754a4e\", \"vnf\": [ { \"member-vnf-index\": \"1\", \"vdu\": [ { \"id\": \"PrometheusCharmedVNF-VM\", \"interface\": [ { \"name\": \"eth0\", \"floating-ip-required\": true } ] } ] } ], \"vld\": [ { \"name\": \"public\", \"vim-network-name\": \"OSMFIVE_selfservice01\" }, { \"name\": \"network1\", \"vim-network-name\": \"provider10_vlan401\" }, { \"name\": \"network2\", \"vim-network-name\": \"provider10_vlan1000\" }, { \"name\": \"network3\", \"ip-profile\": { \"ip-version\": \"ipv4\", \"subnet-address\": \"192.168.101.0/24\", \"gateway-address\": \"0.0.0.0\", \"dns-server\": [ { \"address\": \"8.8.8.8\" } ], \"dhcp-params\": { \"enabled\": true } }, \"vnfd-connection-point-ref\": [ { \"member-vnf-index-ref\": \"1\", \"vnfd-connection-point-ref\": \"vnf-cp3\", \"ip-address\": \"192.168.101.100\" } ] }, { \"name\": \"network4\", \"ip-profile\": { \"ip-version\": \"ipv4\", \"subnet-address\": \"192.168.102.0/24\", \"gateway-address\": \"0.0.0.0\", \"dns-server\": [ { \"address\": \"8.8.8.8\" } ], \"dhcp-params\": { \"enabled\": true } }, \"vnfd-connection-point-ref\": [ { \"member-vnf-index-ref\": \"1\", \"vnfd-connection-point-ref\": \"vnf-cp4\", \"ip-address\": \"192.168.102.100\" } ] }, { \"name\": \"network5\", \"ip-profile\": { \"ip-version\": \"ipv4\", \"subnet-address\": \"192.168.103.0/24\", \"gateway-address\": \"0.0.0.0\", \"dns-server\": [ { \"address\": \"8.8.8.8\" } ], \"dhcp-params\": { \"enabled\": true } }, \"vnfd-connection-point-ref\": [ { \"member-vnf-index-ref\": \"1\", \"vnfd-connection-point-ref\": \"vnf-cp5\", \"ip-address\": \"192.168.103.100\" } ] } ], \"additionalParamsForVnf\": [ { \"member-vnf-index\": \"1\", \"additionalParams\": { \"Targets\": \"172.16.10.203,172.16.10.205,192.168.101.101\" } } ] } Maximum Number of cameras 100 Open5GCore-2enb_nsd::OSM_CONFIG strOsmConfig3 EQ image of Network Assistanse Server (NASS) naas:latest image of Network Assistanse Server (NASS) HIGHAVAIL EQ Number of reserved hours 10 image of Network Assistanse Server (NASS) LOWAVAIL ",
+ "code": "String param3 = getCharValAsString(\"Number of reserved hours\");\nsetCharValFromStringType(\"Open5GCore-2enb_nsd::nsName\", \"myNsNAME\");\nString configutationPrimitive = \"{ \\\"tvg\\\": { \\\"ip\\\": \\\"\\\", \\\"channel1\\\": { \\\"mode\\\": \\\"0\\\" } } }\";\nsetCharValNumber(\"Number of reserved hours\", 24);\nint i = getCharValNumber(\"Number of reserved hours\");\nsetCharValNumber(\"Maximum Number of cameras\", 16);\nsetCharValFromSetType(\"cirros_2vnf_nsd::Primitive::fsetup\", \"[{\\\"value\\\":\\\"1\\\",\\\"alias\\\":\\\"member_vnf_index\\\"},{\\\"value\\\":\\\"fsetup\\\",\\\"alias\\\":\\\"primitive\\\"},{\\\"value\\\":\\\"$$XVALS_configutationPrimitive_XVALE$$\\\",\\\"alias\\\":\\\"confjson\\\"}]\");\nString strTargetsParam = \"172.16.10.203,172.16.10.205,192.168.101.101\";\nString strOsmConfig3 = String.join(\"\", \"{ \\\"nsdId\\\": \\\"59065615-9b6b-4344-8432-1eb7975a37e7\\\", \\\"vimAccountId\\\": \\\"eb0db325-6cc0-4763-813e-0d06ff754a4e\\\", \\\"vnf\\\": [ { \\\"member-vnf-index\\\": \\\"1\\\", \\\"vdu\\\": [ { \\\"id\\\": \\\"PrometheusCharmedVNF-VM\\\", \\\"interface\\\": [ { \\\"name\\\": \\\"eth0\\\", \\\"floating-ip-required\\\": true } ] } ] } ], \\\"vld\\\": [ { \\\"name\\\": \\\"public\\\", \\\"vim-network-name\\\": \\\"OSMFIVE_selfservice01\\\" }, { \\\"name\\\": \\\"network1\\\", \\\"vim-network-name\\\": \\\"provider10_vlan401\\\" }, { \\\"name\\\": \\\"network2\\\", \\\"vim-network-name\\\": \\\"provider10_vlan1000\\\" }, { \\\"name\\\": \\\"network3\\\", \\\"ip-profile\\\": { \\\"ip-version\\\": \\\"ipv4\\\", \\\"subnet-address\\\": \\\"192.168.101.0/24\\\", \\\"gateway-address\\\": \\\"0.0.0.0\\\", \\\"dns-server\\\": [ { \\\"address\\\": \\\"8.8.8.8\\\" } ], \\\"dhcp-params\\\": { \\\"enabled\\\": true } }, \\\"vnfd-connection-point-ref\\\": [ { \\\"member-vnf-index-ref\\\": \\\"1\\\", \\\"vnfd-connection-point-ref\\\": \\\"vnf-cp3\\\", \\\"ip-address\\\": \\\"192.168.101.100\\\" } ] }, { \\\"name\\\": \\\"network4\\\", \\\"ip-profile\\\": { \\\"ip-version\\\": \\\"ipv4\\\", \\\"subnet-address\\\": \\\"192.168.102.0/24\\\", \\\"gateway-address\\\": \\\"0.0.0.0\\\", \\\"dns-server\\\": [ { \\\"address\\\": \\\"8.8.8.8\\\" } ], \\\"dhcp-params\\\": { \\\"enabled\\\": true } }, \\\"vnfd-connection-point-ref\\\": [ { \\\"member-vnf-index-ref\\\": \\\"1\\\", \\\"vnfd-connection-point-ref\\\": \\\"vnf-cp4\\\", \\\"ip-address\\\": \\\"192.168.102.100\\\" } ] }, { \\\"name\\\": \\\"network5\\\", \\\"ip-profile\\\": { \\\"ip-version\\\": \\\"ipv4\\\", \\\"subnet-address\\\": \\\"192.168.103.0/24\\\", \\\"gateway-address\\\": \\\"0.0.0.0\\\", \\\"dns-server\\\": [ { \\\"address\\\": \\\"8.8.8.8\\\" } ], \\\"dhcp-params\\\": { \\\"enabled\\\": true } }, \\\"vnfd-connection-point-ref\\\": [ { \\\"member-vnf-index-ref\\\": \\\"1\\\", \\\"vnfd-connection-point-ref\\\": \\\"vnf-cp5\\\", \\\"ip-address\\\": \\\"192.168.103.100\\\" } ] } ], \\\"additionalParamsForVnf\\\": [ { \\\"member-vnf-index\\\": \\\"1\\\", \\\"additionalParams\\\": { \\\"Targets\\\": \\\"\",strTargetsParam,\"\\\" } } ] }\");\nif (getCharValNumber(\"Video quality of the mobile cameras\") == 3) {\n setCharValNumber(\"Maximum Number of cameras\", 8);\n setCharValFromStringType(\"Open5GCore-2enb_nsd::OSM_CONFIG\", \"{\\\"nsdId\\\":\\\"59065615-9b6b-4344-8432-1eb7975a37e7\\\",\\\"vimAccountId\\\":\\\"eb0db325-6cc0-4763-813e-0d06ff754a4e\\\",\\\"vnf\\\":[{\\\"member-vnf-index\\\":\\\"1\\\",\\\"vdu\\\":[{\\\"id\\\":\\\"PrometheusCharmedVNF-VM\\\",\\\"interface\\\":[{\\\"name\\\":\\\"eth0\\\",\\\"floating-ip-required\\\":true}]}]}],\\\"vld\\\":[{\\\"name\\\":\\\"public\\\",\\\"vim-network-name\\\":\\\"OSMFIVE_selfservice01\\\"},{\\\"name\\\":\\\"network1\\\",\\\"vim-network-name\\\":\\\"provider10_vlan401\\\"},{\\\"name\\\":\\\"network3\\\",\\\"ip-profile\\\":{\\\"ip-version\\\":\\\"ipv4\\\",\\\"subnet-address\\\":\\\"192.168.101.0/24\\\",\\\"gateway-address\\\":\\\"0.0.0.0\\\",\\\"dns-server\\\":[{\\\"address\\\":\\\"8.8.8.8\\\"}],\\\"dhcp-params\\\":{\\\"enabled\\\":true}},\\\"vnfd-connection-point-ref\\\":[{\\\"member-vnf-index-ref\\\":\\\"1\\\",\\\"vnfd-connection-point-ref\\\":\\\"vnf-cp3\\\",\\\"ip-address\\\":\\\"192.168.101.100\\\"}]}],\\\"additionalParamsForVnf\\\":[{\\\"member-vnf-index\\\":\\\"1\\\",\\\"additionalParams\\\":{\\\"Target1Hours\\\":\\\"$$XVALS_i_XVALE$$\\\",\\\"Target2\\\":\\\"55555\\\",\\\"Target3MaxCameras\\\":\\\"$$XVALS_getCharValAsString($QUOTESTR$Maximum Number of cameras$QUOTESTR$)_XVALE$$\\\"}}]}\");\n} else if (getCharValNumber(\"Video quality of the mobile cameras\") == 2) {\n setCharValNumber(\"Maximum Number of cameras\", 20);\n setCharValFromStringType(\"Open5GCore-2enb_nsd::OSM_CONFIG\", \"{ \\\"nsdId\\\": \\\"59065615-9b6b-4344-8432-1eb7975a37e7\\\", \\\"vimAccountId\\\": \\\"eb0db325-6cc0-4763-813e-0d06ff754a4e\\\", \\\"vnf\\\": [ { \\\"member-vnf-index\\\": \\\"1\\\", \\\"vdu\\\": [ { \\\"id\\\": \\\"PrometheusCharmedVNF-VM\\\", \\\"interface\\\": [ { \\\"name\\\": \\\"eth0\\\", \\\"floating-ip-required\\\": true } ] } ] } ], \\\"vld\\\": [ { \\\"name\\\": \\\"public\\\", \\\"vim-network-name\\\": \\\"OSMFIVE_selfservice01\\\" }, { \\\"name\\\": \\\"network1\\\", \\\"vim-network-name\\\": \\\"provider10_vlan401\\\" }, { \\\"name\\\": \\\"network2\\\", \\\"vim-network-name\\\": \\\"provider10_vlan1000\\\" }, { \\\"name\\\": \\\"network3\\\", \\\"ip-profile\\\": { \\\"ip-version\\\": \\\"ipv4\\\", \\\"subnet-address\\\": \\\"192.168.101.0/24\\\", \\\"gateway-address\\\": \\\"0.0.0.0\\\", \\\"dns-server\\\": [ { \\\"address\\\": \\\"8.8.8.8\\\" } ], \\\"dhcp-params\\\": { \\\"enabled\\\": true } }, \\\"vnfd-connection-point-ref\\\": [ { \\\"member-vnf-index-ref\\\": \\\"1\\\", \\\"vnfd-connection-point-ref\\\": \\\"vnf-cp3\\\", \\\"ip-address\\\": \\\"192.168.101.100\\\" } ] }, { \\\"name\\\": \\\"network4\\\", \\\"ip-profile\\\": { \\\"ip-version\\\": \\\"ipv4\\\", \\\"subnet-address\\\": \\\"192.168.102.0/24\\\", \\\"gateway-address\\\": \\\"0.0.0.0\\\", \\\"dns-server\\\": [ { \\\"address\\\": \\\"8.8.8.8\\\" } ], \\\"dhcp-params\\\": { \\\"enabled\\\": true } }, \\\"vnfd-connection-point-ref\\\": [ { \\\"member-vnf-index-ref\\\": \\\"1\\\", \\\"vnfd-connection-point-ref\\\": \\\"vnf-cp4\\\", \\\"ip-address\\\": \\\"192.168.102.100\\\" } ] }, { \\\"name\\\": \\\"network5\\\", \\\"ip-profile\\\": { \\\"ip-version\\\": \\\"ipv4\\\", \\\"subnet-address\\\": \\\"192.168.103.0/24\\\", \\\"gateway-address\\\": \\\"0.0.0.0\\\", \\\"dns-server\\\": [ { \\\"address\\\": \\\"8.8.8.8\\\" } ], \\\"dhcp-params\\\": { \\\"enabled\\\": true } }, \\\"vnfd-connection-point-ref\\\": [ { \\\"member-vnf-index-ref\\\": \\\"1\\\", \\\"vnfd-connection-point-ref\\\": \\\"vnf-cp5\\\", \\\"ip-address\\\": \\\"192.168.103.100\\\" } ] } ], \\\"additionalParamsForVnf\\\": [ { \\\"member-vnf-index\\\": \\\"1\\\", \\\"additionalParams\\\": { \\\"Targets\\\": \\\"172.16.10.203,172.16.10.205,192.168.101.101\\\" } } ] }\");\n} else {\n setCharValNumber(\"Maximum Number of cameras\", 100);\n setCharValFromStringType(\"Open5GCore-2enb_nsd::OSM_CONFIG\", strOsmConfig3);\n}\nif (getCharValFromStringType(\"image of Network Assistanse Server (NASS)\").equals(\"naas:latest\")==true) {\n setCharValFromStringType(\"image of Network Assistanse Server (NASS)\", \"HIGHAVAIL\");\n} else if (getCharValAsString(\"Number of reserved hours\").equals(\"10\")==true) {\n setCharValFromStringType(\"image of Network Assistanse Server (NASS)\", \"LOWAVAIL\");\n}\n",
+ "priority": 0,
+ "serviceSpecs": [
+ {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Upstream journalist case",
+ "version": null,
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "0d5551e6-069f-43b7-aa71-10530f290239"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/test/resources/LcmRule4Test.json b/src/test/resources/LcmRule4Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..ba36d8e5fd4b9ae016ae867ccf1f95f65d4e2fc0
--- /dev/null
+++ b/src/test/resources/LcmRule4Test.json
@@ -0,0 +1,31 @@
+{
+ "uuid": "49e2e679-9dc1-4c7b-abd9-72377d4c1a5d",
+ "lastUpdate": null,
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "BaseEntity",
+ "href": null,
+ "name": "LCM Rule Upstream journalist case Web ",
+ "description": "LCM Rule for specification Upstream journalist case",
+ "lifecycleStatus": "In study",
+ "version": null,
+ "validFor": null,
+ "id": "49e2e679-9dc1-4c7b-abd9-72377d4c1a5d",
+ "lcmrulephase": "PRE_PROVISION",
+ "content": "categoryName reqUrl strResponse categoryName {\"name\":\"sx- Quality Class -nd\", \"description\":\"testdesctr\",\"lifecycleStatus\":\"In design\",\"validFor\":{\"endDateTime\":\"2041-08-31T11:23:59.752Z\",\"startDateTime\":\"2021-08-31T11:23:59.752Z\"},\"version\":\"2.1.0\"} reqUrl http://portal.openslice.io/tmf-api/serviceCatalogManagement/v4/serviceCandidate/ec23953a-f036-4723-85c0-33f03eb00c7f ?nsName= Open5GCore-2enb_nsd::nsName &area= Quality Class strResponse GET reqUrl strResponse strResponse POST http://portal.openslice.io osapiWebClientId secret admin;read http://portal.openslice.io/auth/realms/openslice/protocol/openid-connect/token admin openslice http://portal.openslice.io/tmf-api/serviceCatalogManagement/v4/serviceCatalog categoryName strResponse ",
+ "code": "String categoryName = String.join(\"\", \"{\\\"name\\\":\\\"sx-\",getCharValAsString(\"Quality Class\"),\"-nd\\\", \\\"description\\\":\\\"testdesctr\\\",\\\"lifecycleStatus\\\":\\\"In design\\\",\\\"validFor\\\":{\\\"endDateTime\\\":\\\"2041-08-31T11:23:59.752Z\\\",\\\"startDateTime\\\":\\\"2021-08-31T11:23:59.752Z\\\"},\\\"version\\\":\\\"2.1.0\\\"}\");\nString reqUrl = String.join(\"\", \"http://portal.openslice.io/tmf-api/serviceCatalogManagement/v4/serviceCandidate/ec23953a-f036-4723-85c0-33f03eb00c7f\",\"?nsName=\",getCharValFromStringType(\"Open5GCore-2enb_nsd::nsName\"),\"&area=\",getCharValAsString(\"Quality Class\"));\nString strResponse = rest_block(\"GET\",reqUrl,null,null);\nlogtext(strResponse);\nstrResponse = rest_block(\"POST\", \"http://portal.openslice.io/tmf-api/serviceCatalogManagement/v4/serviceCatalog\", null, categoryName, \"http://portal.openslice.io\", \"osapiWebClientId\", \"secret\", \"admin;read\", \"http://portal.openslice.io/auth/realms/openslice/protocol/openid-connect/token\", \"admin\", \"openslice\");\nlogtext(strResponse);\n",
+ "priority": 2,
+ "serviceSpecs": [
+ {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Upstream journalist case",
+ "version": null,
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "0d5551e6-069f-43b7-aa71-10530f290239"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/test/resources/LcmRule5Test.json b/src/test/resources/LcmRule5Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..11dd8c408754895775405d273263271d00538b86
--- /dev/null
+++ b/src/test/resources/LcmRule5Test.json
@@ -0,0 +1,31 @@
+{
+ "uuid": "c1bd362d-011f-485b-a7d9-3bb05a2f6868",
+ "lastUpdate": null,
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "BaseEntity",
+ "href": null,
+ "name": "LCM Rule Upstream journalist case Web get response",
+ "description": "LCM Rule for specification Upstream journalist case",
+ "lifecycleStatus": "In study",
+ "version": null,
+ "validFor": null,
+ "id": "c1bd362d-011f-485b-a7d9-3bb05a2f6868",
+ "lcmrulephase": "PRE_PROVISION",
+ "content": "strResponse strResponse GET http://portal.openslice.io osapiWebClientId secret admin;read http://portal.openslice.io/auth/realms/openslice/protocol/openid-connect/token admin openslice http://portal.openslice.io/tmf-api/serviceInventory/v4/service/ead09790-6dcc-4fff-a1de-4eb5d104aaa3 name strResponse serviceCharacteristicValue strResponse VIM ",
+ "code": "String strResponse = rest_block(\"GET\", \"http://portal.openslice.io/tmf-api/serviceInventory/v4/service/ead09790-6dcc-4fff-a1de-4eb5d104aaa3\", null, null, \"http://portal.openslice.io\", \"osapiWebClientId\", \"secret\", \"admin;read\", \"http://portal.openslice.io/auth/realms/openslice/protocol/openid-connect/token\", \"admin\", \"openslice\");\nlogtext(getFromPayloadServicePropValue(strResponse, \"name\", \"\"));\nlogtext(getFromPayloadServicePropValue(strResponse, \"serviceCharacteristicValue\", \"VIM\"));\n",
+ "priority": 4,
+ "serviceSpecs": [
+ {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Upstream journalist case",
+ "version": null,
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "0d5551e6-069f-43b7-aa71-10530f290239"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/test/resources/LcmRuleListSpecTest.json b/src/test/resources/LcmRuleListSpecTest.json
new file mode 100644
index 0000000000000000000000000000000000000000..1bb2c037a0b239bff9840b866a2ae3d1e47d6dbd
--- /dev/null
+++ b/src/test/resources/LcmRuleListSpecTest.json
@@ -0,0 +1,16 @@
+[
+ {
+ "uuid": "40f027b5-24a9-4db7-b422-a963c9feeb7a",
+ "id": "40f027b5-24a9-4db7-b422-a963c9feeb7a",
+ "name": "OSM config depending on class",
+ "description": "LCM Rule for specification Cirros Test OSM config depending on class",
+ "lcmrulephase": "PRE_PROVISION"
+ },
+ {
+ "uuid": "75cebf16-1699-486f-8304-d6512f90c910",
+ "id": "75cebf16-1699-486f-8304-d6512f90c910",
+ "name": "LCM Rule Cirros Test rule2",
+ "description": "LCM Rule for specification Cirros Test rule 2 example",
+ "lcmrulephase": "PRE_PROVISION"
+ }
+]
\ No newline at end of file
diff --git a/src/test/resources/LcmTest1.java b/src/test/resources/LcmTest1.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff979936a21fcc142f6870918fa3a7fb28af17f6
--- /dev/null
+++ b/src/test/resources/LcmTest1.java
@@ -0,0 +1,229 @@
+import org.etsi.osl.tmf.scm633.model.ServiceSpecification;
+
+public class LcmTest1 {
+
+ public static ServiceSpecification run(ServiceSpecification spec) {
+
+ //SNIP START
+ if (getCharValNumber("Video quality of the mobile cameras") == 3) {
+ setCharValNumber("Maximum Number of cameras", 10);
+ setCharValString("Open5GCore-2enb_nsd::OSM_CONFIG", """
+ {
+ "nsdId": "59065615-9b6b-4344-8432-1eb7975a37e7",
+ "vimAccountId": "eb0db325-6cc0-4763-813e-0d06ff754a4e",
+ "vnf": [
+ {
+ "member-vnf-index": "1",
+ "vdu": [
+ {
+ "id": "PrometheusCharmedVNF-VM",
+ "interface": [
+ {
+ "name": "eth0",
+ "floating-ip-required": true
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "vld": [
+ {
+ "name": "public",
+ "vim-network-name": "OSMFIVE_selfservice01"
+ },
+ {
+ "name": "network1",
+ "vim-network-name": "provider10_vlan401"
+ },
+ {
+ "name": "network3",
+ "ip-profile": {
+ "ip-version": "ipv4",
+ "subnet-address": "192.168.101.0/24",
+ "gateway-address": "0.0.0.0",
+ "dns-server": [
+ {
+ "address": "8.8.8.8"
+ }
+ ],
+ "dhcp-params": {
+ "enabled": true
+ }
+ },
+ "vnfd-connection-point-ref": [
+ {
+ "member-vnf-index-ref": "1",
+ "vnfd-connection-point-ref": "vnf-cp3",
+ "ip-address": "192.168.101.100"
+ }
+ ]
+ }
+ ],
+ "additionalParamsForVnf": [
+ {
+ "member-vnf-index": "1",
+ "additionalParams": {
+ "Target1": "val1",
+ "Target2": "val2",
+ "Target3": "val3"
+ }
+ }
+ ]
+ }
+ """);
+ } else if (getCharValNumber("Video quality of the mobile cameras") == 2) {
+ setCharValNumber("Maximum Number of cameras", 20);
+ setCharValString("Open5GCore-2enb_nsd::OSM_CONFIG", """
+ {
+ "nsdId": "59065615-9b6b-4344-8432-1eb7975a37e7",
+ "vimAccountId": "eb0db325-6cc0-4763-813e-0d06ff754a4e",
+ "vnf": [
+ {
+ "member-vnf-index": "1",
+ "vdu": [
+ {
+ "id": "PrometheusCharmedVNF-VM",
+ "interface": [
+ {
+ "name": "eth0",
+ "floating-ip-required": true
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "vld": [
+ {
+ "name": "public",
+ "vim-network-name": "OSMFIVE_selfservice01"
+ },
+ {
+ "name": "network1",
+ "vim-network-name": "provider10_vlan401"
+ },
+ {
+ "name": "network2",
+ "vim-network-name": "provider10_vlan1000"
+ },
+ {
+ "name": "network3",
+ "ip-profile": {
+ "ip-version": "ipv4",
+ "subnet-address": "192.168.101.0/24",
+ "gateway-address": "0.0.0.0",
+ "dns-server": [
+ {
+ "address": "8.8.8.8"
+ }
+ ],
+ "dhcp-params": {
+ "enabled": true
+ }
+ },
+ "vnfd-connection-point-ref": [
+ {
+ "member-vnf-index-ref": "1",
+ "vnfd-connection-point-ref": "vnf-cp3",
+ "ip-address": "192.168.101.100"
+ }
+ ]
+ },
+ {
+ "name": "network4",
+ "ip-profile": {
+ "ip-version": "ipv4",
+ "subnet-address": "192.168.102.0/24",
+ "gateway-address": "0.0.0.0",
+ "dns-server": [
+ {
+ "address": "8.8.8.8"
+ }
+ ],
+ "dhcp-params": {
+ "enabled": true
+ }
+ },
+ "vnfd-connection-point-ref": [
+ {
+ "member-vnf-index-ref": "1",
+ "vnfd-connection-point-ref": "vnf-cp4",
+ "ip-address": "192.168.102.100"
+ }
+ ]
+ },
+ {
+ "name": "network5",
+ "ip-profile": {
+ "ip-version": "ipv4",
+ "subnet-address": "192.168.103.0/24",
+ "gateway-address": "0.0.0.0",
+ "dns-server": [
+ {
+ "address": "8.8.8.8"
+ }
+ ],
+ "dhcp-params": {
+ "enabled": true
+ }
+ },
+ "vnfd-connection-point-ref": [
+ {
+ "member-vnf-index-ref": "1",
+ "vnfd-connection-point-ref": "vnf-cp5",
+ "ip-address": "192.168.103.100"
+ }
+ ]
+ }
+ ],
+ "additionalParamsForVnf": [
+ {
+ "member-vnf-index": "1",
+ "additionalParams": {
+ "Targets": "172.16.10.203,172.16.10.205,192.168.101.101"
+ }
+ }
+ ]
+ }
+ """);
+ } else {
+ setCharValNumber("Maximum Number of cameras", 100);
+ setCharValString("Open5GCore-2enb_nsd::OSM_CONFIG", """
+ {
+ "nsdId": "59065615-9b6b-4344-8432-1eb7975a37e7",
+ "vimAccountId": ""
+ }
+ """);
+ }
+ if (getCharValString("image of Network Assistanse Server (NASS)").equals("test")==true) {
+ setCharValString("image of Network Assistanse Server (NASS)", "HIGHAVAIL");
+ }
+
+
+ //SNIP END
+ spec.setName( spec.getName() + "_changed Maximum Number of cameras!" );
+ return spec;
+ }
+
+ private static String getCharValString(String s) {
+ return s;
+ }
+
+
+ private static void setCharValString(String string, String string2) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private static void setCharValNumber(String string, int i) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private static int getCharValNumber(String string) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/src/test/resources/NFVO_Example.json b/src/test/resources/NFVO_Example.json
new file mode 100644
index 0000000000000000000000000000000000000000..b187516ba32cbeacbbb2b53eed0644413dc73b68
--- /dev/null
+++ b/src/test/resources/NFVO_Example.json
@@ -0,0 +1,606 @@
+{
+ "uuid": "0399516f-e9ae-4c8e-8f7a-b13ad9a1bd00",
+ "lastUpdate": "2020-05-29T18:59:03+03:00",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": "CustomerFacingServiceSpecification",
+ "href": null,
+ "name": "Copy of Monitoring Service Example",
+ "description": "Monitoring Service Example",
+ "lifecycleStatus": "In study",
+ "version": "0.1.0",
+ "validFor": {
+ "endDateTime": "2040-05-29T18:57:53+03:00",
+ "startDateTime": "2020-05-29T18:57:53+03:00"
+ },
+ "isBundle": true,
+ "attachment": [],
+ "relatedParty": [],
+ "resourceSpecification": [],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "888f5295-8ece-4bbd-9ad1-d6f0c9689fe2",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::Netdata4_IP",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "50eed4ab-bb8f-415f-bdc6-ab2806a641c8",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2040-05-29T18:59:03+03:00",
+ "startDateTime": "2020-05-29T18:59:03+03:00"
+ },
+ "value": {
+ "value": "192.168.199.140",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:56+03:00",
+ "startDateTime": "2020-05-29T15:29:56+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "888f5295-8ece-4bbd-9ad1-d6f0c9689fe2"
+ },
+ {
+ "uuid": "d1bfc476-5a06-40a4-93f4-94519dd1755e",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::OnBoardingStatus",
+ "configurable": false,
+ "description": "NSDtOnBoardingStatus",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "9afbf51c-18f1-4d82-a114-26d8f32b7e83",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "ONBOARDED",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "d1bfc476-5a06-40a4-93f4-94519dd1755e"
+ },
+ {
+ "uuid": "f22919af-404f-4bee-9a75-7a7acaa3fd65",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::NSDID",
+ "configurable": false,
+ "description": "NSD id",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "29f36556-c330-4754-8494-81c60855f324",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "40",
+ "alias": "id"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "f22919af-404f-4bee-9a75-7a7acaa3fd65"
+ },
+ {
+ "uuid": "98d38975-0de4-44e7-9b59-82b8963fdd97",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::PackageLocation",
+ "configurable": false,
+ "description": "NSD PackageLocation",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "c8d7ed9c-85c7-45f1-864d-8963f96141c3",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "http://openslice-portalapi:13000/osapi/packages/c803996c-9d40-4384-90f1-51396837ec16/Monitoring_nsd.tar.gz",
+ "alias": "PackageLocation"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "98d38975-0de4-44e7-9b59-82b8963fdd97"
+ },
+ {
+ "uuid": "c213b59f-c2a0-488a-bed5-bfecb0608e49",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::SSHKEY",
+ "configurable": false,
+ "description": "SSH public key",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "20192e4b-6669-47ad-aca6-94b8bfe2b79d",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "c213b59f-c2a0-488a-bed5-bfecb0608e49"
+ },
+ {
+ "uuid": "5b1b326d-e19e-42fb-bdd8-e22e39a54c9b",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::CONFIG",
+ "configurable": false,
+ "description": "Initial config to OSM",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "25a41cb8-2d4c-49aa-934b-34532e6bab67",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T18:58:17+03:00",
+ "startDateTime": "2020-05-29T18:58:17+03:00"
+ },
+ "value": {
+ "value": "{ \"nsdId\": \"02aba53e-4af5-4222-91ce-1a14540d5b39\", \"vimAccountId\": \"c224eb48-419e-4097-8a1d-11ec1bba087f\", \"nsName\": \"ttest\", \"nsDescription\": \"desc\", \t\"vnf\": [ \t\t{ \t\t\t\"member-vnf-index\": \"1\", \t\t\t\"vdu\": [ \t\t\t\t{ \t\t\t\t\t\"id\": \"Prometheus-VM\", \t\t\t\t\t\"interface\": [ \t\t\t\t\t\t{ \t\t\t\t\t\t\t\"name\": \"eth1\", \t\t\t\t\t\t\t\"floating-ip-required\": true \t\t\t\t\t\t} \t\t\t\t\t] \t\t\t\t} \t\t\t] \t\t} \t], \t\"vld\": [ \t\t{ \t\t\t\"name\": \"Management\", \t\t\t\"vim-network-name\": \"testingnet\", \t\t\t\"vnfd-connection-point-ref\": [ \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"2\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.110\" \t\t\t\t}, \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"3\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.120\" \t\t\t\t}, \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"4\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.130\" \t\t\t\t}, \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"5\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.140\" \t\t\t\t} \t\t\t] \t\t} \t] }",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "5b1b326d-e19e-42fb-bdd8-e22e39a54c9b"
+ },
+ {
+ "uuid": "a9987ec7-8253-4b09-9eb5-7837c182457f",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::Netdata3_IP",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "592e4a66-38db-406e-98ed-30c03561728f",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2040-05-29T18:58:55+03:00",
+ "startDateTime": "2020-05-29T18:58:55+03:00"
+ },
+ "value": {
+ "value": "192.168.199.130",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:47+03:00",
+ "startDateTime": "2020-05-29T15:29:47+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "a9987ec7-8253-4b09-9eb5-7837c182457f"
+ },
+ {
+ "uuid": "040b72a3-9eae-450a-b403-aa9e85ed025c",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::PackagingFormat",
+ "configurable": false,
+ "description": "NSD PackagingFormat",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "66541a66-0fde-46bb-a9e7-84b2da070a3c",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "OSMvSEVEN",
+ "alias": "PackagingFormat"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "040b72a3-9eae-450a-b403-aa9e85ed025c"
+ },
+ {
+ "uuid": "b4a660b3-d2ed-498e-ae68-618d94239ecd",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::Vendor",
+ "configurable": false,
+ "description": "NSD Vendor",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "2ee92b9e-61a6-41c4-9f3c-544015bb4fb3",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": null,
+ "alias": "Vendor"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "b4a660b3-d2ed-498e-ae68-618d94239ecd"
+ },
+ {
+ "uuid": "6a79f2e6-2c2c-435f-9c70-426e70e5e498",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::Netdata2_IP",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "1d002e98-3bc4-4998-a044-cfa75022144e",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2040-05-29T18:58:45+03:00",
+ "startDateTime": "2020-05-29T18:58:45+03:00"
+ },
+ "value": {
+ "value": "192.168.199.120",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:34+03:00",
+ "startDateTime": "2020-05-29T15:29:34+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "6a79f2e6-2c2c-435f-9c70-426e70e5e498"
+ },
+ {
+ "uuid": "420c3979-6e01-433f-8727-43c70ab339ad",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::ObMANOprovider_Name",
+ "configurable": false,
+ "description": "NSD Onboarded MANO provider Name",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "ae3d1ec5-4d9c-4f12-801f-6d58d2d3b9b0",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "osm seven",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "420c3979-6e01-433f-8727-43c70ab339ad"
+ },
+ {
+ "uuid": "5880a01d-2331-4da9-9b69-ad2374456a8b",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Monitoring_nsd::Netdata1_IP",
+ "configurable": false,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "0022e428-ca5d-482e-8f62-aec2687024a2",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2040-05-29T18:58:36+03:00",
+ "startDateTime": "2020-05-29T18:58:36+03:00"
+ },
+ "value": {
+ "value": "192.168.199.110",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:21+03:00",
+ "startDateTime": "2020-05-29T15:29:21+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "5880a01d-2331-4da9-9b69-ad2374456a8b"
+ }
+ ],
+ "serviceSpecRelationship": [
+ {
+ "uuid": "bebbeb8e-55fb-4c53-b1db-98866f0dc4a5",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecRelationship",
+ "href": null,
+ "name": "Monitoring_nsd",
+ "id": "22e399d3-b152-4966-9d0f-20e5b2ec42c4",
+ "relationshipType": null,
+ "role": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T18:57:53+03:00",
+ "startDateTime": "2020-05-29T18:57:53+03:00"
+ }
+ }
+ ],
+ "targetServiceSchema": null,
+ "id": "0399516f-e9ae-4c8e-8f7a-b13ad9a1bd00"
+}
\ No newline at end of file
diff --git a/src/test/resources/NFVO_Example_Order.json b/src/test/resources/NFVO_Example_Order.json
new file mode 100644
index 0000000000000000000000000000000000000000..c0854d9c8ff9b399206146b4637b2524e175f5fa
--- /dev/null
+++ b/src/test/resources/NFVO_Example_Order.json
@@ -0,0 +1,248 @@
+{
+ "uuid": "49eaa909-3caf-4a2d-94f0-379cf59ce3f1",
+ "orderDate": "2020-06-01T00:41:39+03:00",
+ "completionDate": null,
+ "expectedCompletionDate": "2020-07-02T00:41:33+03:00",
+ "requestedCompletionDate": "2020-07-02T00:41:33+03:00",
+ "requestedStartDate": "2020-06-01T00:41:33+03:00",
+ "startDate": null,
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "ServiceOrder",
+ "href": null,
+ "id": "49eaa909-3caf-4a2d-94f0-379cf59ce3f1",
+ "category": null,
+ "description": null,
+ "externalId": null,
+ "notificationContact": null,
+ "priority": null,
+ "note": [
+ {
+ "uuid": "1275226d-bbac-4b4c-a28d-4871edea846f",
+ "date": "2020-06-01T00:41:39+03:00",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "author": "admin",
+ "system": null,
+ "text": ""
+ }
+ ],
+ "orderItem": [
+ {
+ "uuid": "481ae2dd-6347-4b1f-b2ea-373ca388ebd2",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "id": "481ae2dd-6347-4b1f-b2ea-373ca388ebd2",
+ "action": "add",
+ "orderItemRelationship": [],
+ "state": "INITIAL",
+ "service": {
+ "uuid": "b5be806d-40ed-4f81-93f9-02029d869867",
+ "serviceSpecification": {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Copy of Monitoring Service Example",
+ "version": "0.1.0",
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "0399516f-e9ae-4c8e-8f7a-b13ad9a1bd00"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": null,
+ "id": "b5be806d-40ed-4f81-93f9-02029d869867",
+ "category": null,
+ "serviceType": null,
+ "place": [],
+ "relatedParty": [],
+ "serviceCharacteristic": [
+ {
+ "uuid": "a3c8581c-374c-4062-ac44-ee289f85768a",
+ "value": {
+ "value": "192.168.199.130",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::Netdata3_IP",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "565a8b64-2ab9-4557-81aa-76086e6d155c",
+ "value": {
+ "value": "osm seven",
+ "alias": ""
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::ObMANOprovider_Name",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "ab9ae065-2494-4e42-ae83-9fc618e53a76",
+ "value": {
+ "value": "40",
+ "alias": "id"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::NSDID",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "74d91790-72d9-4fd7-8135-4067e964ab15",
+ "value": {
+ "value": "ONBOARDED",
+ "alias": ""
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::OnBoardingStatus",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "ce87796d-78ea-491e-911e-5f434db2f1eb",
+ "value": {
+ "value": "192.168.199.120",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::Netdata2_IP",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "ae8ee757-5756-4e4e-afc1-132f0348d95a",
+ "value": {
+ "value": "",
+ "alias": ""
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::SSHKEY",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "78f086c1-c324-4f81-a6ac-584d227e8753",
+ "value": {
+ "value": "192.168.199.110",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::Netdata1_IP",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "d2bc1d49-a57c-41f0-a598-eead66e10ced",
+ "value": {
+ "value": null,
+ "alias": "Vendor"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::Vendor",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "74063a2d-e59e-4f21-80e7-e14dd05771a3",
+ "value": {
+ "value": "192.168.199.140",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::Netdata4_IP",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "9ab4b6e6-81b2-4b84-9d38-da647354f720",
+ "value": {
+ "value": "{ \"nsdId\": \"02aba53e-4af5-4222-91ce-1a14540d5b39\", \"vimAccountId\": \"c224eb48-419e-4097-8a1d-11ec1bba087f\", \"nsName\": \"ttest\", \"nsDescription\": \"desc\", \t\"vnf\": [ \t\t{ \t\t\t\"member-vnf-index\": \"1\", \t\t\t\"vdu\": [ \t\t\t\t{ \t\t\t\t\t\"id\": \"Prometheus-VM\", \t\t\t\t\t\"interface\": [ \t\t\t\t\t\t{ \t\t\t\t\t\t\t\"name\": \"eth1\", \t\t\t\t\t\t\t\"floating-ip-required\": true \t\t\t\t\t\t} \t\t\t\t\t] \t\t\t\t} \t\t\t] \t\t} \t], \t\"vld\": [ \t\t{ \t\t\t\"name\": \"Management\", \t\t\t\"vim-network-name\": \"testingnet\", \t\t\t\"vnfd-connection-point-ref\": [ \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"2\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.110\" \t\t\t\t}, \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"3\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.120\" \t\t\t\t}, \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"4\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.130\" \t\t\t\t}, \t\t\t\t{ \t\t\t\t\t\"member-vnf-index-ref\": \"5\", \t\t\t\t\t\"vnfd-connection-point-ref\": \"vnf-cp0\", \t\t\t\t\t\"ip-address\": \"192.168.199.140\" \t\t\t\t} \t\t\t] \t\t} \t] }",
+ "alias": ""
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::CONFIG",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "c33e33eb-f48b-49c6-90d1-7da6058200da",
+ "value": {
+ "value": "http://openslice-portalapi:13000/osapi/packages/c803996c-9d40-4384-90f1-51396837ec16/Monitoring_nsd.tar.gz",
+ "alias": "PackageLocation"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::PackageLocation",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "3b4005c0-f3cf-4ee9-a0ac-49dd71f88761",
+ "value": {
+ "value": "OSMvSEVEN",
+ "alias": "PackagingFormat"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Monitoring_nsd::PackagingFormat",
+ "valueType": "TEXT"
+ }
+ ],
+ "state": "feasibilityChecked",
+ "supportingResource": [],
+ "serviceRelationship": [],
+ "supportingService": []
+ },
+ "appointment": null
+ }
+ ],
+ "orderRelationship": [],
+ "relatedParty": [
+ {
+ "uuid": "63dc176c-75b7-4bfd-94f5-fb62e126781c",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "href": null,
+ "name": "admin",
+ "role": "REQUESTER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": "admin",
+ "extendedInfo": "tranoris@ece.upatras.gr"
+ }
+ ],
+ "state": "ACKNOWLEDGED"
+}
\ No newline at end of file
diff --git a/src/test/resources/NFVO_Example_RFS.json b/src/test/resources/NFVO_Example_RFS.json
new file mode 100644
index 0000000000000000000000000000000000000000..50c6fb5bc3eea388a1d4a59bd71f68eba7c31898
--- /dev/null
+++ b/src/test/resources/NFVO_Example_RFS.json
@@ -0,0 +1,549 @@
+{
+ "uuid": "22e399d3-b152-4966-9d0f-20e5b2ec42c4",
+ "lastUpdate": "2020-05-29T15:35:49+03:00",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": "ResourceFacingServiceSpecification",
+ "href": null,
+ "name": "Monitoring_nsd",
+ "description": "Monitoring_nsd",
+ "lifecycleStatus": "In study",
+ "version": "1.0",
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "isBundle": false,
+ "attachment": [],
+ "relatedParty": [],
+ "resourceSpecification": [
+ {
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef",
+ "href": null,
+ "name": "Monitoring_nsd",
+ "version": "1.0",
+ "@referredType": null,
+ "id": "9c7d726e-2752-4acd-a443-a0610de00653"
+ }
+ ],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "78290d37-a1e2-48a4-a239-f8af819dbea2",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Netdata2_IP",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "30f237a4-b3e5-4152-99f1-1121e6e1c23a",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:44+03:00",
+ "startDateTime": "2020-05-29T15:29:44+03:00"
+ },
+ "value": null
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:34+03:00",
+ "startDateTime": "2020-05-29T15:29:34+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "78290d37-a1e2-48a4-a239-f8af819dbea2"
+ },
+ {
+ "uuid": "1ae72704-5186-4c4e-a7a0-2bcf5adc9239",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Netdata4_IP",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "8132748d-a839-44ff-8ed9-75760a89a972",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2040-05-29T15:30:07+03:00",
+ "startDateTime": "2020-05-29T15:30:07+03:00"
+ },
+ "value": null
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:56+03:00",
+ "startDateTime": "2020-05-29T15:29:56+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "1ae72704-5186-4c4e-a7a0-2bcf5adc9239"
+ },
+ {
+ "uuid": "39b4257e-ea3a-4d76-bc10-b8b7b64defa2",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Netdata3_IP",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:47+03:00",
+ "startDateTime": "2020-05-29T15:29:47+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "39b4257e-ea3a-4d76-bc10-b8b7b64defa2"
+ },
+ {
+ "uuid": "78cb3f7d-5390-4472-9d9b-7f70cce01d56",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "PackageLocation",
+ "configurable": false,
+ "description": "NSD PackageLocation",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "f74ab748-8d94-4953-8619-43d220e23176",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "http://openslice-portalapi:13000/osapi/packages/c803996c-9d40-4384-90f1-51396837ec16/Monitoring_nsd.tar.gz",
+ "alias": "PackageLocation"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "78cb3f7d-5390-4472-9d9b-7f70cce01d56"
+ },
+ {
+ "uuid": "34ec5cc9-6f6c-41ab-9e26-4d624dbc4dae",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "SSHKEY",
+ "configurable": false,
+ "description": "SSH public key",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "8e2c5512-d73c-47dd-99c5-4566452b7594",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "34ec5cc9-6f6c-41ab-9e26-4d624dbc4dae"
+ },
+ {
+ "uuid": "0a895916-f588-470b-84bf-20381cbe6eef",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "NSDID",
+ "configurable": false,
+ "description": "NSD id",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "0619d059-6c5a-4910-aaf5-8211a82a784f",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "40",
+ "alias": "id"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "0a895916-f588-470b-84bf-20381cbe6eef"
+ },
+ {
+ "uuid": "b2de4a52-eb0e-43af-bfb9-3ee7319a67c7",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "PackagingFormat",
+ "configurable": false,
+ "description": "NSD PackagingFormat",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "a40950ce-4e67-4e36-839d-2e9a94101296",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "OSMvSEVEN",
+ "alias": "PackagingFormat"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "b2de4a52-eb0e-43af-bfb9-3ee7319a67c7"
+ },
+ {
+ "uuid": "6976a36c-88e3-4488-9f9b-7c43ba5f6f66",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "ObMANOprovider_Name",
+ "configurable": false,
+ "description": "NSD Onboarded MANO provider Name",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "6ea35e76-6895-4b15-97b4-84bf03d2e813",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "osm seven",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "6976a36c-88e3-4488-9f9b-7c43ba5f6f66"
+ },
+ {
+ "uuid": "80d2bc9d-7696-42f0-b750-49f186e5dfd2",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Netdata1_IP",
+ "configurable": false,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [],
+ "validFor": {
+ "endDateTime": "2040-05-29T15:29:21+03:00",
+ "startDateTime": "2020-05-29T15:29:21+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "80d2bc9d-7696-42f0-b750-49f186e5dfd2"
+ },
+ {
+ "uuid": "ae30aa05-a74b-4879-bc43-e3809a04be57",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "CONFIG",
+ "configurable": false,
+ "description": "Initial config to OSM",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "013aaec1-3d07-4455-bd0b-6a8ccf2d538b",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "ae30aa05-a74b-4879-bc43-e3809a04be57"
+ },
+ {
+ "uuid": "587662d6-3853-4ff7-ad73-9a48717477ba",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Vendor",
+ "configurable": false,
+ "description": "NSD Vendor",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "0378c5b5-ad95-4a4a-a8fe-112f3f625fc6",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": null,
+ "alias": "Vendor"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "587662d6-3853-4ff7-ad73-9a48717477ba"
+ },
+ {
+ "uuid": "95bf00a3-bb58-4a47-879e-d8ec1ef69a59",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "OnBoardingStatus",
+ "configurable": false,
+ "description": "NSDtOnBoardingStatus",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "550dac44-ce74-424f-9b8b-0e30ec3365db",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "value": {
+ "value": "ONBOARDED",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-05-29T14:58:55+03:00",
+ "startDateTime": "2020-05-29T14:58:55+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "95bf00a3-bb58-4a47-879e-d8ec1ef69a59"
+ }
+ ],
+ "serviceSpecRelationship": [],
+ "targetServiceSchema": null,
+ "id": "22e399d3-b152-4966-9d0f-20e5b2ec42c4"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestExBundleSpec.json b/src/test/resources/TestExBundleSpec.json
new file mode 100644
index 0000000000000000000000000000000000000000..d527f71e08cdf69322aca9397d2ee0923078d94a
--- /dev/null
+++ b/src/test/resources/TestExBundleSpec.json
@@ -0,0 +1,613 @@
+{
+ "uuid": "f2b74f90-4140-4895-80d1-ef243398117b",
+ "lastUpdate": "2021-08-18T01:22:31+03:00",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": "CustomerFacingServiceSpecification",
+ "href": null,
+ "name": "Cirros Test",
+ "description": "A Cirros Test",
+ "lifecycleStatus": "In design",
+ "version": "0.1.0",
+ "validFor": {
+ "endDateTime": "2040-09-06T23:51:05+03:00",
+ "startDateTime": "2020-09-06T23:51:05+03:00"
+ },
+ "isBundle": true,
+ "attachment": [],
+ "relatedParty": [
+ {
+ "uuid": "76b0a43c-1d13-4c1e-bcb9-d9ed1bc96f42",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "href": null,
+ "name": "admin",
+ "role": "OWNER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": "admin",
+ "extendedInfo": ""
+ }
+ ],
+ "resourceSpecification": [],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "32ec48ae-9cef-4c1d-a395-60d0edd54929",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::Vendor",
+ "configurable": false,
+ "description": "NSD Vendor",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "31fab415-4c81-4908-a5ee-e6174aa858d1",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "OSM",
+ "alias": "Vendor"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "32ec48ae-9cef-4c1d-a395-60d0edd54929"
+ },
+ {
+ "uuid": "11a2b2fe-52fe-47bd-818d-0446fbb50121",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Quality Class",
+ "configurable": true,
+ "description": "define the Quality Class of the service",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "1c15c037-1356-4292-865d-5cd72b38906e",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-18T01:22:31+03:00",
+ "startDateTime": "2021-08-18T01:22:31+03:00"
+ },
+ "value": {
+ "value": "0",
+ "alias": "SILVER"
+ }
+ },
+ {
+ "uuid": "248dc9c4-3205-4200-8bf8-15802f9b82fd",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-18T01:22:31+03:00",
+ "startDateTime": "2021-08-18T01:22:31+03:00"
+ },
+ "value": {
+ "value": "1",
+ "alias": "GOLD"
+ }
+ },
+ {
+ "uuid": "c698dc35-268c-497b-9f4c-d49744610694",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-18T01:22:31+03:00",
+ "startDateTime": "2021-08-18T01:22:31+03:00"
+ },
+ "value": {
+ "value": "2",
+ "alias": "PLATINUM"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2041-08-18T01:21:23+03:00",
+ "startDateTime": "2021-08-18T01:21:23+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "11a2b2fe-52fe-47bd-818d-0446fbb50121"
+ },
+ {
+ "uuid": "be37567e-6942-41e5-8b5c-d824f9a2b77e",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::ObMANOprovider_Name",
+ "configurable": false,
+ "description": "NSD Onboarded MANO provider Name",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "6ab1e22e-b52d-4ca2-94db-9f0df9cd0587",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "GenericSOL005",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "be37567e-6942-41e5-8b5c-d824f9a2b77e"
+ },
+ {
+ "uuid": "bcf790f3-7dbd-4384-8c94-ba775bd87c6a",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::NSDID",
+ "configurable": false,
+ "description": "NSD id",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "5e015c50-6947-415a-8c12-bfe820a62d7d",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "33",
+ "alias": "id"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "bcf790f3-7dbd-4384-8c94-ba775bd87c6a"
+ },
+ {
+ "uuid": "54ca7576-50de-4991-a903-0b044a71eb20",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::SSHKEY",
+ "configurable": false,
+ "description": "SSH public key",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "e5e5d906-44ed-40ad-933d-cde48a240ad6",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "MYKEYX",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "54ca7576-50de-4991-a903-0b044a71eb20"
+ },
+ {
+ "uuid": "c4446fd0-0608-4192-99da-cebd21b10114",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::MemberVNFIndex_1",
+ "configurable": false,
+ "description": "Member VNF Index",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "1cfb7d8c-8fe6-4549-8306-ed448534e325",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "1",
+ "alias": "cirros_vnfd"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "c4446fd0-0608-4192-99da-cebd21b10114"
+ },
+ {
+ "uuid": "f87cb321-818b-4297-9cb7-092ff1c7eb18",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::OSM_CONFIG",
+ "configurable": false,
+ "description": "Initial config to OSM",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "8d25851f-b1e5-4969-8ce6-1a6339322faf",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2041-08-18T01:18:01+03:00",
+ "startDateTime": "2021-08-18T01:18:01+03:00"
+ },
+ "value": {
+ "value": "{ \"nsdId\": \"0b6853fc-8219-4580-9697-bf4a8f0a08f9\", \"vimAccountId\": \"c224eb48-419e-4097-8a1d-11ec1bba087f\", \"wimAccountId\": false } ",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "f87cb321-818b-4297-9cb7-092ff1c7eb18"
+ },
+ {
+ "uuid": "556707f7-b30a-4e48-b1ea-35ec5f8e3500",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::PackagingFormat",
+ "configurable": false,
+ "description": "NSD PackagingFormat",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "24692f3a-2780-48de-8f1b-719a3d19c08c",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "GenericSOL005",
+ "alias": "PackagingFormat"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "556707f7-b30a-4e48-b1ea-35ec5f8e3500"
+ },
+ {
+ "uuid": "c85ef980-bc81-47ec-afc3-d5d6e35a18be",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::PackageLocation",
+ "configurable": false,
+ "description": "NSD PackageLocation",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "03867f58-3d3d-4c04-bf92-39115b6ca9bc",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "http://openslice-portalapi:13000/osapi/packages/5afddb42-9edc-40d0-9d9a-76a4621660db/cirros_2vnf_ns.tar.gz",
+ "alias": "PackageLocation"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "c85ef980-bc81-47ec-afc3-d5d6e35a18be"
+ },
+ {
+ "uuid": "eca01dab-3c77-48c5-8c9b-61ce442f6b1c",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::OnBoardingStatus",
+ "configurable": false,
+ "description": "NSDtOnBoardingStatus",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "ece1a0d0-8fcd-4cfa-9eb6-f5e63370c88a",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "ONBOARDED",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "eca01dab-3c77-48c5-8c9b-61ce442f6b1c"
+ },
+ {
+ "uuid": "80e50d90-4cf9-4b6f-a29b-c4bf1a26af2c",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_ns::MemberVNFIndex_2",
+ "configurable": false,
+ "description": "Member VNF Index",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "7ecbec2a-2bdf-460e-a117-d0d90aa9a6a7",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "2",
+ "alias": "cirros_vnfd"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "80e50d90-4cf9-4b6f-a29b-c4bf1a26af2c"
+ }
+ ],
+ "serviceSpecRelationship": [
+ {
+ "uuid": "3cd8129e-ec2c-43b6-9879-2a4cec20a5ad",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecRelationship",
+ "href": null,
+ "name": "cirros_2vnf_ns",
+ "id": "99176116-17cf-464f-96f7-86e685914666",
+ "relationshipType": null,
+ "role": null,
+ "validFor": null
+ }
+ ],
+ "targetServiceSchema": null,
+ "id": "f2b74f90-4140-4895-80d1-ef243398117b"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestExServiceOrder.json b/src/test/resources/TestExServiceOrder.json
new file mode 100644
index 0000000000000000000000000000000000000000..3bfd6d5805783b97c93af359934ae6340e5592bb
--- /dev/null
+++ b/src/test/resources/TestExServiceOrder.json
@@ -0,0 +1,119 @@
+{
+ "uuid": "a842a6fd-a9df-4d0e-9e17-922954a100c6",
+ "orderDate": "2021-08-18T21:55:05+03:00",
+ "completionDate": null,
+ "expectedCompletionDate": "2021-08-19T21:55:01+03:00",
+ "requestedCompletionDate": "2021-08-19T21:55:01+03:00",
+ "requestedStartDate": "2021-08-18T21:55:01+03:00",
+ "startDate": "2021-08-18T21:55:01+03:00",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "ServiceOrder",
+ "href": null,
+ "id": "a842a6fd-a9df-4d0e-9e17-922954a100c6",
+ "category": null,
+ "description": null,
+ "externalId": null,
+ "notificationContact": null,
+ "priority": null,
+ "note": [
+ {
+ "uuid": "1567e358-ff96-4bc5-8978-9677d8ec17db",
+ "date": "2021-08-18T21:55:05+03:00",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "author": "SO641API-addServiceOrder",
+ "system": null,
+ "text": "Service Order ACKNOWLEDGED"
+ }
+ ],
+ "orderItem": [
+ {
+ "uuid": "7501ebe7-4f3c-48a3-a3ed-978a279c31a0",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "id": "7501ebe7-4f3c-48a3-a3ed-978a279c31a0",
+ "action": "add",
+ "orderItemRelationship": [],
+ "state": "ACKNOWLEDGED",
+ "service": {
+ "uuid": "30883a98-53fa-4b70-b37e-a3823037df85",
+ "serviceSpecification": {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Cirros Test",
+ "version": "0.1.0",
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "f2b74f90-4140-4895-80d1-ef243398117b"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Cirros Test",
+ "id": "30883a98-53fa-4b70-b37e-a3823037df85",
+ "category": null,
+ "serviceType": null,
+ "place": [],
+ "relatedParty": [],
+ "serviceCharacteristic": [
+ {
+ "uuid": "9beae187-1621-482c-b1b5-b97c2b990ca7",
+ "value": {
+ "value": "1",
+ "alias": "GOLD"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Quality Class",
+ "valueType": "ENUM"
+ },
+
+ {
+ "uuid": "fffae187-1621-482c-b1b5-b97c2b990fff",
+ "value": {
+ "value": "MCKEYTESTINORDER",
+ "alias": ""
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "cirros_2vnf_ns::SSHKEY",
+ "valueType": "TEXT"
+ }
+ ],
+ "state": "feasibilityChecked",
+ "supportingResource": [],
+ "serviceRelationship": [],
+ "supportingService": []
+ },
+ "appointment": null
+ }
+ ],
+ "orderRelationship": [],
+ "relatedParty": [
+ {
+ "uuid": "2c37b4bf-4f26-49a2-b9da-842b12d9276f",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "href": null,
+ "name": "admin",
+ "role": "REQUESTER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": "admin",
+ "extendedInfo": null
+ }
+ ],
+ "state": "ACKNOWLEDGED"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestExServiceOrder_upstream.json b/src/test/resources/TestExServiceOrder_upstream.json
new file mode 100644
index 0000000000000000000000000000000000000000..8999fe3c9107296c0e0e5639ea4a6a8365cca56d
--- /dev/null
+++ b/src/test/resources/TestExServiceOrder_upstream.json
@@ -0,0 +1,275 @@
+{
+ "uuid": "cd9be2d7-cce4-4f29-af74-8d8a0b3bdf07",
+ "orderDate": "2021-09-04T10:06:53.548738882Z",
+ "completionDate": null,
+ "expectedCompletionDate": "2021-09-05T10:06:42.048Z",
+ "requestedCompletionDate": "2021-09-05T10:06:42.048Z",
+ "requestedStartDate": "2021-09-04T10:06:42.048Z",
+ "startDate": "2021-09-04T10:06:42.048Z",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "ServiceOrder",
+ "href": null,
+ "id": "cd9be2d7-cce4-4f29-af74-8d8a0b3bdf07",
+ "category": null,
+ "description": null,
+ "externalId": null,
+ "notificationContact": null,
+ "priority": null,
+ "note": [
+ {
+ "uuid": "6ddde22f-2452-40bc-8642-2c15e081972b",
+ "date": "2021-09-04T10:06:53.548975510Z",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "author": "SO641API-addServiceOrder",
+ "system": null,
+ "text": "Service Order INITIAL"
+ }
+ ],
+ "orderItem": [
+ {
+ "uuid": "b1032fac-ba32-4841-b9c4-3aa1527bf447",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "id": "b1032fac-ba32-4841-b9c4-3aa1527bf447",
+ "action": "add",
+ "orderItemRelationship": [],
+ "state": "INITIAL",
+ "service": {
+ "uuid": "6fa9f003-981f-4def-88d6-f4b3be29521e",
+ "serviceSpecification": {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Upstream journalist case",
+ "version": "0.1.0",
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "0d5551e6-069f-43b7-aa71-10530f290239"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Upstream journalist case",
+ "id": "6fa9f003-981f-4def-88d6-f4b3be29521e",
+ "category": null,
+ "serviceType": null,
+ "place": [],
+ "relatedParty": [],
+ "serviceCharacteristic": [
+ {
+ "uuid": "0e8490aa-a0ed-4715-af7a-1015a8495442",
+ "value": {
+ "value": "[{\"value\":\"GR\",\"alias\":\"Greece\"}]",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Area of Service",
+ "valueType": "SET"
+ },
+ {
+ "uuid": "9c432354-3154-432c-a21d-03d1071ea270",
+ "value": {
+ "value": "691c8956-0369-4b91-b914-b61dccba74db",
+ "alias": "Cloudville"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Open5GCore-2enb_nsd::VIM",
+ "valueType": "ENUM"
+ },
+ {
+ "uuid": "0daafce5-1e87-40a8-a6aa-1ac4f8e5ffb4",
+ "value": {
+ "value": "5",
+ "alias": "id"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "cirros_2vnf_nsd::NSDID",
+ "valueType": "TEXT"
+ },
+ {
+ "uuid": "87cd43d8-bb38-4ce6-b014-de49d768d543",
+ "value": {
+ "value": "0",
+ "alias": "Audio"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Director return channel to cameras",
+ "valueType": "ENUM"
+ },
+ {
+ "uuid": "7baa0a5b-7215-4878-b7e5-e157a25410b4",
+ "value": {
+ "value": "3",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Maximum Number of cameras",
+ "valueType": "SMALLINT"
+ },
+ {
+ "uuid": "e1dba003-4bf8-4c10-984a-66320254b034",
+ "value": {
+ "value": "[{\"value\":\"22\",\"alias\":\"param2\"},{\"value\":\"100\",\"alias\":\"PARAM1\"},{\"value\":\"33\",\"alias\":\"param3\"}]",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "test actions_array",
+ "valueType": "ARRAY"
+ },
+ {
+ "uuid": "d97ed3fc-c73a-466d-82eb-ab0e01b0e238",
+ "value": {
+ "value": "2",
+ "alias": "2"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Number of reserved hours",
+ "valueType": "SMALLINT"
+ },
+ {
+ "uuid": "6f80e380-c54f-44be-bc08-d176f30d8175",
+ "value": {
+ "value": "1",
+ "alias": "Live (1s)"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Video response time of the mobile cameras",
+ "valueType": "ENUM"
+ },
+ {
+ "uuid": "bab8dbb8-f0c8-4ef9-a8e3-fbb60c6049dc",
+ "value": {
+
+ "value":"[{\"value\":\"1\",\"alias\":\"member_vnf_index\"},{\"value\":\"fsetup\",\"alias\":\"primitive\"},{\"value\":\"{ \\\"tvg\\\": { \\\"ip\\\": \\\"\\\", \\\"channel1\\\": { \\\"mode\\\": \\\"0\\\" } } }\",\"alias\":\"confjson\"}]",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "cirros_2vnf_nsd::Primitive::fsetup",
+ "valueType": "ARRAY"
+ },
+ {
+ "uuid": "48d89de5-06ce-4ebd-8227-4f6164325a0a",
+ "value": {
+ "value": "[{\"value\":\"1000\",\"alias\":\"test param 4\"},{\"value\":\"10\",\"alias\":\"test param 3\"}]",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "test actions_set",
+ "valueType": "SET"
+ },
+ {
+ "uuid": "b2ba3428-5832-445b-953c-f263ff6d5b64",
+ "value": {
+ "value": "0",
+ "alias": "SD"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Video quality of the mobile cameras",
+ "valueType": "ENUM"
+ },
+ {
+ "uuid": "13e096ee-8aaa-4400-b163-15fbd6999e54",
+ "value": {
+ "value": "2310",
+ "alias": "Patras"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Location of NASS",
+ "valueType": "ENUM"
+ },
+ {
+ "uuid": "48168bda-16ad-4f05-bf43-1b89de2e7796",
+ "value": {
+ "value": "2610",
+ "alias": "Patras"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Location of Mobile Cameras",
+ "valueType": "ENUM"
+ },
+ {
+ "uuid": "bc4d869c-e542-42ec-9ea9-6e6d9cabc8db",
+ "value": {
+ "value": "FALSE",
+ "alias": null
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "High Availability",
+ "valueType": "BOOLEAN"
+ }
+ ],
+ "state": "feasibilityChecked",
+ "supportingResource": [],
+ "serviceRelationship": [],
+ "supportingService": []
+ },
+ "appointment": null
+ }
+ ],
+ "orderRelationship": [],
+ "relatedParty": [
+ {
+ "uuid": "93a0a564-8ed0-45c4-9be6-7b03ad6d2d5d",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "href": null,
+ "name": "admin",
+ "role": "REQUESTER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": "admin",
+ "extendedInfo": null
+ }
+ ],
+ "state": "INITIAL"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestExSpec1.json b/src/test/resources/TestExSpec1.json
new file mode 100644
index 0000000000000000000000000000000000000000..fe7373479dfb7c330aa201970b2736a0b1ef0aa5
--- /dev/null
+++ b/src/test/resources/TestExSpec1.json
@@ -0,0 +1,113 @@
+{
+ "uuid": "59d08753-e1b1-418b-9e3e-d3a3bb573051",
+ "lastUpdate": "2019-11-19T08:18:17.811Z",
+ "@baseType": "BaseEntity",
+ "@type": "CustomerFacingServiceSpecification",
+ "name": "Spec1",
+ "description": "Test Spec example",
+ "lifecycleStatus": "In study",
+ "version": "1.8.0",
+ "isBundle": false,
+ "attachment": [],
+ "relatedParty": [
+ {
+ "uuid": "2d1b0321-bcb5-4bca-807e-9b3923c5e4dd",
+ "@baseType": "BaseRootEntity",
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "name": "osadmin",
+ "role": "OWNER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": "2d1b0321-bcb5-4bca-807e-9b3923c5e4dd"
+ }
+ ],
+ "resourceSpecification": [],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "8a9462f3-ec03-4fe7-80ae-52c30708a0ec",
+ "@baseType": "BaseRootEntity",
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "name": "Coverage",
+ "configurable": true,
+ "description": "This attribute specifies the coverage area of the network slice - the area where the terminals can access a particular network slice",
+ "isUnique": true,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [
+ {
+ "uuid": "a53c4c8b-2e84-404e-85f2-b7284222c399",
+ "id": "Spec1-Character Attribute",
+ "name": "Character Attribute",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.811Z",
+ "startDateTime": "2019-11-19T08:18:17.811Z"
+ }
+ },
+ {
+ "uuid": "7c582b92-bf23-4587-b765-4b8ed85abbcd",
+ "id": "Spec1-KPI",
+ "name": "KPI",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.811Z",
+ "startDateTime": "2019-11-19T08:18:17.811Z"
+ }
+ },
+ {
+ "uuid": "ae7f7b55-bdb7-415c-95be-bd19392fd31f",
+ "id": "Spec1-Operational",
+ "name": "Operational",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.811Z",
+ "startDateTime": "2019-11-19T08:18:17.811Z"
+ }
+ },
+ {
+ "uuid": "70fdbebd-e5d3-4a1d-a2dd-7ffb3b3729c1",
+ "id": "Spec1-Scalability Attribute",
+ "name": "Scalability Attribute",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.811Z",
+ "startDateTime": "2019-11-19T08:18:17.811Z"
+ }
+ }
+ ],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "7507f32b-d80d-4795-bc3a-330866e86b61",
+ "@baseType": "BaseEntity",
+ "isDefault": true,
+ "unitOfMeasure": "N/A",
+ "valueType": "SMALLINT",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.811Z",
+ "startDateTime": "2019-11-19T08:18:17.811Z"
+ },
+ "value": {
+ "value": "4",
+ "alias": "Local (outdoor)"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.811Z",
+ "startDateTime": "2019-11-19T08:18:17.811Z"
+ },
+ "id": "8a9462f3-ec03-4fe7-80ae-52c30708a0ec"
+ }
+ ],
+ "serviceSpecRelationship": [],
+ "id": "59d08753-e1b1-418b-9e3e-d3a3bb573051"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestExSpec2.json b/src/test/resources/TestExSpec2.json
new file mode 100644
index 0000000000000000000000000000000000000000..85828b9ce3986d7caeb57a63b35d71f2031eacf3
--- /dev/null
+++ b/src/test/resources/TestExSpec2.json
@@ -0,0 +1,120 @@
+{
+ "uuid": "a7ff2349-ccab-42a1-9212-51d4a1912247",
+ "lastUpdate": "2019-11-19T08:18:17.883Z",
+ "@baseType": "BaseEntity",
+ "@type": "ResourceFacingServiceSpecification",
+ "name": "Spec2",
+ "description": "Test Spec example",
+ "lifecycleStatus": "In study",
+ "version": "1.8.0",
+ "isBundle": false,
+ "attachment": [],
+ "relatedParty": [
+ {
+ "uuid": "46e30947-c84d-4bd9-9cfd-e3b1b9f389d7",
+ "@baseType": "BaseRootEntity",
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "name": "osadmin",
+ "role": "OWNER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": "46e30947-c84d-4bd9-9cfd-e3b1b9f389d7"
+ }
+ ],
+ "resourceSpecification": [
+ {
+ "@baseType": "BaseRootEntity",
+ "@type": "org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef",
+ "name": "resourceName",
+ "id": "resourceid"
+ }
+ ],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "af627b12-c723-4df8-bb06-ed8be317dd29",
+ "@baseType": "BaseRootEntity",
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "name": "Coverage",
+ "configurable": true,
+ "description": "This attribute specifies the coverage area of the network slice - the area where the terminals can access a particular network slice",
+ "isUnique": true,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [
+ {
+ "uuid": "7dc1467d-cf5b-4b96-b123-b76f4a40391b",
+ "id": "Spec2-KPI",
+ "name": "KPI",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.883Z",
+ "startDateTime": "2019-11-19T08:18:17.883Z"
+ }
+ },
+ {
+ "uuid": "002d8c1b-0028-45c0-ac8c-a210c419ac5f",
+ "id": "Spec2-Character Attribute",
+ "name": "Character Attribute",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.883Z",
+ "startDateTime": "2019-11-19T08:18:17.883Z"
+ }
+ },
+ {
+ "uuid": "2334fada-2222-4b92-9acd-890e97a03321",
+ "id": "Spec2-Operational",
+ "name": "Operational",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.883Z",
+ "startDateTime": "2019-11-19T08:18:17.883Z"
+ }
+ },
+ {
+ "uuid": "b538b081-76ea-4f9a-9a32-449dcaf22c10",
+ "id": "Spec2-Scalability Attribute",
+ "name": "Scalability Attribute",
+ "relationshipType": "dependency",
+ "@baseType": "BaseEntity",
+ "role": "tag",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.883Z",
+ "startDateTime": "2019-11-19T08:18:17.883Z"
+ }
+ }
+ ],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "07de2ced-c74d-4a81-8dcd-d6256255f637",
+ "@baseType": "BaseEntity",
+ "isDefault": true,
+ "unitOfMeasure": "N/A",
+ "valueType": "SMALLINT",
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.883Z",
+ "startDateTime": "2019-11-19T08:18:17.883Z"
+ },
+ "value": {
+ "value": "4",
+ "alias": "Local (outdoor)"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-11-19T08:18:17.883Z",
+ "startDateTime": "2019-11-19T08:18:17.883Z"
+ },
+ "id": "af627b12-c723-4df8-bb06-ed8be317dd29"
+ }
+ ],
+ "serviceSpecRelationship": [],
+ "id": "a7ff2349-ccab-42a1-9212-51d4a1912247"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestExSpec3.json b/src/test/resources/TestExSpec3.json
new file mode 100644
index 0000000000000000000000000000000000000000..45d29e3862bbe27ace930f0befd52bacb062709e
--- /dev/null
+++ b/src/test/resources/TestExSpec3.json
@@ -0,0 +1,1788 @@
+{
+ "uuid": "0d5551e6-069f-43b7-aa71-10530f290239",
+ "lastUpdate": "2021-09-04T10:04:05Z",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": "CustomerFacingServiceSpecification",
+ "href": null,
+ "name": "Upstream journalist case",
+ "description": "Example: “Upstream journalist case”\nA service provider (SP) wants to provide an upstream video service on demand (“pay as you go”)\nalso in case of an unplanned incident (e.g. “Breaking news”)\nOn the spot, live\nQuick setup\nPremium service (pricing: high)\nThis is based on 5G Day Session 2: 5G as a Service (5GaaS) – easy access for 3rd parties to 5G technology (Piotr Zuraniewski - TNO) from 8th OSM Hackfest",
+ "lifecycleStatus": "In design",
+ "version": "0.1.0",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:35:37Z",
+ "startDateTime": "2019-12-13T21:35:37Z"
+ },
+ "isBundle": true,
+ "attachment": [
+ {
+ "uuid": "ade72f6c-8d21-4b96-ad3e-f48f24052a6b",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "logo.jpg",
+ "id": "e58f2aaf-fe4f-404f-86bc-d69b6d2b2cd0",
+ "description": null,
+ "url": "/serviceCatalogManagement/v4/serviceSpecification/0d5551e6-069f-43b7-aa71-10530f290239/attachment/e58f2aaf-fe4f-404f-86bc-d69b6d2b2cd0/logo.jpg",
+ "@referredType": null
+ }
+ ],
+ "relatedParty": [
+ {
+ "uuid": "4e668e92-1875-41a6-bbc4-d01184cb3e31",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "href": null,
+ "name": "anonymousUser",
+ "role": "OWNER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": null,
+ "extendedInfo": null
+ }
+ ],
+ "resourceSpecification": [],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "00dc9fa5-0f44-485f-a210-d15d7b2cab71",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Open5GCore-2enb_nsd::nsName",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "e2956648-56c0-4de0-bfb4-2254d24e5c4a",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:21:47Z",
+ "startDateTime": "2019-12-13T21:21:47Z"
+ },
+ "value": {
+ "value": "Open5GCore-2enb_nsd",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:19:51Z",
+ "startDateTime": "2019-12-13T21:19:51Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "00dc9fa5-0f44-485f-a210-d15d7b2cab71"
+ },
+ {
+ "uuid": "646be409-5073-4fea-a5c6-d230295f68ad",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Area of Service",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "SET",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "1423ac7a-bdb5-44dd-b4cb-8278d4308061",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "ES",
+ "alias": "Spain"
+ }
+ },
+ {
+ "uuid": "fad8a832-f810-4287-8d08-aa69d3421976",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "RO",
+ "alias": "Romania"
+ }
+ },
+ {
+ "uuid": "85ef658d-5de1-49dd-a4fd-a17f8d717e1b",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "IT",
+ "alias": "Italy"
+ }
+ },
+ {
+ "uuid": "809447c5-77c0-4546-b5ad-eb8088c4fb5f",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "LI",
+ "alias": "Lithouania"
+ }
+ },
+ {
+ "uuid": "934d0d09-637a-4f06-a070-f8b628963430",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "UK",
+ "alias": "United Kingdom"
+ }
+ },
+ {
+ "uuid": "f563ca75-9b81-4a78-b6a9-884bc869bf48",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "DE",
+ "alias": "Germany"
+ }
+ },
+ {
+ "uuid": "516ec895-c10c-4699-b79d-afdbae8e6a4a",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "FR",
+ "alias": "France"
+ }
+ },
+ {
+ "uuid": "789e651a-5b10-48f1-b7cd-d10c51d95164",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "PT",
+ "alias": "Portugal"
+ }
+ },
+ {
+ "uuid": "f226637a-6802-4633-b482-609544ab07ad",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:31:06Z",
+ "startDateTime": "2021-08-25T15:31:06Z"
+ },
+ "value": {
+ "value": "GR",
+ "alias": "Greece"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2041-08-25T15:28:37Z",
+ "startDateTime": "2021-08-25T15:28:37Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "646be409-5073-4fea-a5c6-d230295f68ad"
+ },
+ {
+ "uuid": "1e1416c7-3862-4453-abb9-e07800476a88",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Video quality of the mobile cameras",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "3a9dbacc-7b23-437e-8a38-8f3dec1b2453",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:24Z",
+ "startDateTime": "2019-12-13T21:52:24Z"
+ },
+ "value": {
+ "value": "2",
+ "alias": "4K"
+ }
+ },
+ {
+ "uuid": "6c63e237-b6c7-42d4-b1ff-f0806a2c3a9a",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:24Z",
+ "startDateTime": "2019-12-13T21:52:24Z"
+ },
+ "value": {
+ "value": "1",
+ "alias": "FHD"
+ }
+ },
+ {
+ "uuid": "ed7d123d-98cc-4141-8ffe-ebf13262dcce",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:24Z",
+ "startDateTime": "2019-12-13T21:52:24Z"
+ },
+ "value": {
+ "value": "0",
+ "alias": "SD"
+ }
+ },
+ {
+ "uuid": "548acd09-752f-4db6-811a-90fc5cd0e8fe",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:24Z",
+ "startDateTime": "2019-12-13T21:52:24Z"
+ },
+ "value": {
+ "value": "3",
+ "alias": "8K"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:45:12Z",
+ "startDateTime": "2019-12-13T21:45:12Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "1e1416c7-3862-4453-abb9-e07800476a88"
+ },
+ {
+ "uuid": "7c07c2ef-7563-4712-8c5f-ab15bf886512",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Video response time of the mobile cameras",
+ "configurable": true,
+ "description": "Video response time of the mobile cameras",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "48c94034-0720-4c21-bc7a-d8391d0bb891",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "sec",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T22:03:31Z",
+ "startDateTime": "2019-12-13T22:03:31Z"
+ },
+ "value": {
+ "value": "0.1",
+ "alias": "Live (0.1s)"
+ }
+ },
+ {
+ "uuid": "a7678bcf-81c4-4463-9b07-1b9ae3de95c1",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "sec",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T22:03:31Z",
+ "startDateTime": "2019-12-13T22:03:31Z"
+ },
+ "value": {
+ "value": "5",
+ "alias": "Live (5s)"
+ }
+ },
+ {
+ "uuid": "c6e25d38-7c2e-4bde-b137-3698b6047843",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "sec",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T22:03:31Z",
+ "startDateTime": "2019-12-13T22:03:31Z"
+ },
+ "value": {
+ "value": "1",
+ "alias": "Live (1s)"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:38Z",
+ "startDateTime": "2019-12-13T21:52:38Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "7c07c2ef-7563-4712-8c5f-ab15bf886512"
+ },
+ {
+ "uuid": "83b7fa9f-28c0-405e-8042-bd7340639ee4",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Open5GCore-2enb_nsd::deployId",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "bc27dc77-6a19-4577-9572-a24f086d1831",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:19:42Z",
+ "startDateTime": "2019-12-13T21:19:42Z"
+ },
+ "value": {
+ "value": "e12d6ef5-4f64-4be3-bc46-fcf2946eb881",
+ "alias": "nsdId"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:17:17Z",
+ "startDateTime": "2019-12-13T21:17:17Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "83b7fa9f-28c0-405e-8042-bd7340639ee4"
+ },
+ {
+ "uuid": "9e8e3bd1-c4e3-4bbf-99f4-ef969bf557a3",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_nsd::NSDID",
+ "configurable": true,
+ "description": "NSD id",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "c9ce9261-37cf-46ca-84e3-36558a209fbf",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-01-29T10:05:33Z",
+ "startDateTime": "2020-01-29T10:05:33Z"
+ },
+ "value": {
+ "value": "5",
+ "alias": "id"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-01-01T23:07:49Z",
+ "startDateTime": "2020-01-01T23:07:49Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "9e8e3bd1-c4e3-4bbf-99f4-ef969bf557a3"
+ },
+ {
+ "uuid": "e1719ead-6b97-4fa8-9cae-ad2e48d66631",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_nsd::ObMANOprovider_Name",
+ "configurable": false,
+ "description": "NSD Onboarded MANO provider Name",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "a8a86b84-0b07-4910-a4c9-8ac07dfbb56e",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-01-09T21:27:43Z",
+ "startDateTime": "2020-01-09T21:27:43Z"
+ },
+ "value": {
+ "value": "uop",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-01-01T23:07:49Z",
+ "startDateTime": "2020-01-01T23:07:49Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "e1719ead-6b97-4fa8-9cae-ad2e48d66631"
+ },
+ {
+ "uuid": "16f684d2-9f8d-4a8a-8a2b-5b8b5c19f302",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_nsd::OnBoardingStatus",
+ "configurable": false,
+ "description": "NSDtOnBoardingStatus",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "e6235da1-f93d-492b-accb-0650ed090174",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-01-10T14:54:13Z",
+ "startDateTime": "2020-01-10T14:54:13Z"
+ },
+ "value": {
+ "value": "ONBOARDED",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-01-01T23:07:49Z",
+ "startDateTime": "2020-01-01T23:07:49Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "16f684d2-9f8d-4a8a-8a2b-5b8b5c19f302"
+ },
+ {
+ "uuid": "4f2a4f1b-35f7-441f-a3f2-b5c250587463",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_nsd::PackagingFormat",
+ "configurable": false,
+ "description": "NSD PackagingFormat",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "7890d3a4-00b9-4e1c-9282-e3a5e8573858",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-01-09T22:43:25Z",
+ "startDateTime": "2020-01-09T22:43:25Z"
+ },
+ "value": {
+ "value": "OSMvFIVE",
+ "alias": "PackagingFormat"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-01-01T23:07:49Z",
+ "startDateTime": "2020-01-01T23:07:49Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "4f2a4f1b-35f7-441f-a3f2-b5c250587463"
+ },
+ {
+ "uuid": "54fb7ed8-e50c-42c0-b5cc-cd948e2fba0e",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_nsd::Vendor",
+ "configurable": false,
+ "description": "NSD Vendor",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "e0adc92d-10f7-4e8c-944c-31226400a46d",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-01-09T22:43:16Z",
+ "startDateTime": "2020-01-09T22:43:16Z"
+ },
+ "value": {
+ "value": "OSM",
+ "alias": "Vendor"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-01-01T23:07:49Z",
+ "startDateTime": "2020-01-01T23:07:49Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "54fb7ed8-e50c-42c0-b5cc-cd948e2fba0e"
+ },
+ {
+ "uuid": "5d83e09c-f150-49cf-9f96-c6ca862b9655",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Maximum Number of cameras",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "SMALLINT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "e3e25b21-3f7c-4403-b92f-5849cf93ec6f",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "SMALLINT",
+ "validFor": {
+ "endDateTime": "2041-08-16T12:37:57Z",
+ "startDateTime": "2021-08-16T12:37:57Z"
+ },
+ "value": {
+ "value": "3",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:43:23Z",
+ "startDateTime": "2019-12-13T21:43:23Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "5d83e09c-f150-49cf-9f96-c6ca862b9655"
+ },
+ {
+ "uuid": "9e6ce9af-c18c-4774-aa33-5382ea7f007a",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_nsd::PackageLocation",
+ "configurable": false,
+ "description": "NSD PackageLocation",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "7db6db63-255a-4dd0-a189-c08e31ee83d9",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-01-09T22:43:06Z",
+ "startDateTime": "2020-01-09T22:43:06Z"
+ },
+ "value": {
+ "value": "/osapi/packages/ed3692a2-33ef-4a68-9a53-b9c5117cb8fe/cirros_2vnf_ns.tar.gz",
+ "alias": "PackageLocation"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-01-01T23:07:49Z",
+ "startDateTime": "2020-01-01T23:07:49Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "9e6ce9af-c18c-4774-aa33-5382ea7f007a"
+ },
+ {
+ "uuid": "1e5c4b8a-f309-42db-bfc6-267b5a8ffec5",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "test actions_array",
+ "configurable": true,
+ "description": "test ",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ARRAY",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "87297f29-7e96-4027-9026-9337c5cd8f27",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:10:30Z",
+ "startDateTime": "2021-08-25T15:10:30Z"
+ },
+ "value": {
+ "value": "33",
+ "alias": "param3"
+ }
+ },
+ {
+ "uuid": "05b0017d-6f40-48a2-9344-d6297bcfccd2",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:10:30Z",
+ "startDateTime": "2021-08-25T15:10:30Z"
+ },
+ "value": {
+ "value": "22",
+ "alias": "param2"
+ }
+ },
+ {
+ "uuid": "4bdda9dc-92e8-429d-86e6-ac07a40990f8",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:10:30Z",
+ "startDateTime": "2021-08-25T15:10:30Z"
+ },
+ "value": {
+ "value": "100",
+ "alias": "PARAM1"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-17T09:09:27Z",
+ "startDateTime": "2020-09-17T09:09:27Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "1e5c4b8a-f309-42db-bfc6-267b5a8ffec5"
+ },
+ {
+ "uuid": "7376c065-086a-4d31-9775-f313805811e7",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Location of Mobile Cameras",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "dffd13af-d55e-4b17-96dd-04d5ab1078aa",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:29Z",
+ "startDateTime": "2019-12-13T21:52:29Z"
+ },
+ "value": {
+ "value": "2310",
+ "alias": "Thessaloniki"
+ }
+ },
+ {
+ "uuid": "4508b3cd-4f94-4996-8afb-da69b0aba4b6",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:29Z",
+ "startDateTime": "2019-12-13T21:52:29Z"
+ },
+ "value": {
+ "value": "2610",
+ "alias": "Patras"
+ }
+ },
+ {
+ "uuid": "f84f8cae-e040-42c2-a6c4-02dc9f3ca907",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:52:29Z",
+ "startDateTime": "2019-12-13T21:52:29Z"
+ },
+ "value": {
+ "value": "210",
+ "alias": "Athens"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:44:05Z",
+ "startDateTime": "2019-12-13T21:44:05Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "7376c065-086a-4d31-9775-f313805811e7"
+ },
+ {
+ "uuid": "ee6542d2-f624-47a5-a1b3-63c08fec9337",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "test",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": null,
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [],
+ "validFor": {
+ "endDateTime": "2041-08-24T02:31:41Z",
+ "startDateTime": "2021-08-24T02:31:41Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "ee6542d2-f624-47a5-a1b3-63c08fec9337"
+ },
+ {
+ "uuid": "f4ec0ca1-6ad4-4e23-9911-90c13c6701e1",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Director return channel to cameras",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "283c6863-7034-489e-ae0d-780269cff8f2",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:57:25Z",
+ "startDateTime": "2019-12-13T21:57:25Z"
+ },
+ "value": {
+ "value": "0",
+ "alias": "Audio"
+ }
+ },
+ {
+ "uuid": "0e4ad6e4-ced3-4db5-9d83-ac38233fc449",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:57:25Z",
+ "startDateTime": "2019-12-13T21:57:25Z"
+ },
+ "value": {
+ "value": "1",
+ "alias": "Video"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:56:51Z",
+ "startDateTime": "2019-12-13T21:56:51Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "f4ec0ca1-6ad4-4e23-9911-90c13c6701e1"
+ },
+ {
+ "uuid": "7204eaaa-afdf-4680-bf69-df0d35897698",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Open5GCore-2enb_nsd::VIM",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "c3771b06-01fa-4384-8490-2a6879ca3921",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:31:31Z",
+ "startDateTime": "2019-12-13T21:31:31Z"
+ },
+ "value": {
+ "value": "ffaea117-66b5-4a0a-9c21-bcef21564224",
+ "alias": "CloudVille NFV-AZ2"
+ }
+ },
+ {
+ "uuid": "3d5e1fec-90be-4810-8c0c-0957668efcc4",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": null,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:31:31Z",
+ "startDateTime": "2019-12-13T21:31:31Z"
+ },
+ "value": {
+ "value": "b5f9e566-a5ad-4afe-91f0-3ac33008b3c8",
+ "alias": "CloudVille nova zone"
+ }
+ },
+ {
+ "uuid": "82911f83-55b3-4ca4-9aeb-57a4a3fb1a69",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:31:31Z",
+ "startDateTime": "2019-12-13T21:31:31Z"
+ },
+ "value": {
+ "value": "691c8956-0369-4b91-b914-b61dccba74db",
+ "alias": "Cloudville"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:28:20Z",
+ "startDateTime": "2019-12-13T21:28:20Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "7204eaaa-afdf-4680-bf69-df0d35897698"
+ },
+ {
+ "uuid": "761864c2-352a-4cff-84de-3c24d95bd181",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "test actions_set",
+ "configurable": true,
+ "description": "test",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "SET",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "cf409680-fa96-42f0-99ee-568e7c3d971b",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:10:23Z",
+ "startDateTime": "2021-08-25T15:10:23Z"
+ },
+ "value": {
+ "value": "1000",
+ "alias": "test param 4"
+ }
+ },
+ {
+ "uuid": "e7a4d765-4791-4f60-b1bd-3f590299d3a9",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:10:23Z",
+ "startDateTime": "2021-08-25T15:10:23Z"
+ },
+ "value": {
+ "value": "10",
+ "alias": "test param 3"
+ }
+ },
+ {
+ "uuid": "60351b4e-686e-45d3-80b6-82759a992cc7",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:10:23Z",
+ "startDateTime": "2021-08-25T15:10:23Z"
+ },
+ "value": {
+ "value": "1",
+ "alias": "test param 1"
+ }
+ },
+ {
+ "uuid": "881e8cc3-854f-4ff3-b5e8-eaed457f09dd",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-08-25T15:10:23Z",
+ "startDateTime": "2021-08-25T15:10:23Z"
+ },
+ "value": {
+ "value": "100",
+ "alias": "test param 2"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-17T09:30:10Z",
+ "startDateTime": "2020-09-17T09:30:10Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "761864c2-352a-4cff-84de-3c24d95bd181"
+ },
+ {
+ "uuid": "ef42d5b4-e6a0-4df2-9de7-1bd60c0c681b",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "High Availability",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "BOOLEAN",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "427fae37-06c8-4bda-ad0f-eddc71669de9",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "BOOLEAN",
+ "validFor": {
+ "endDateTime": "2041-08-25T13:47:59Z",
+ "startDateTime": "2021-08-25T13:47:59Z"
+ },
+ "value": {
+ "value": "FALSE",
+ "alias": null
+ }
+ },
+ {
+ "uuid": "2f4e6fd9-8dab-49fa-9110-733281f98942",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "BOOLEAN",
+ "validFor": {
+ "endDateTime": "2041-08-25T13:47:59Z",
+ "startDateTime": "2021-08-25T13:47:59Z"
+ },
+ "value": {
+ "value": "TRUE",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2041-08-25T13:46:21Z",
+ "startDateTime": "2021-08-25T13:46:21Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "ef42d5b4-e6a0-4df2-9de7-1bd60c0c681b"
+ },
+ {
+ "uuid": "478a7af5-200d-4ef8-9cdd-f18bf59e8e1d",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Location of NASS",
+ "configurable": true,
+ "description": "Location of NASS",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "d6e9e89d-e793-4958-a2bd-a4c1e9f2d1de",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": false,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2040-05-05T15:07:47Z",
+ "startDateTime": "2020-05-05T15:07:47Z"
+ },
+ "value": {
+ "value": "210",
+ "alias": "Athens"
+ }
+ },
+ {
+ "uuid": "f7487da7-dfde-4b56-b00d-035f58aaa46f",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2040-05-05T15:07:47Z",
+ "startDateTime": "2020-05-05T15:07:47Z"
+ },
+ "value": {
+ "value": "2310",
+ "alias": "Patras"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:56:08Z",
+ "startDateTime": "2019-12-13T21:56:08Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "478a7af5-200d-4ef8-9cdd-f18bf59e8e1d"
+ },
+ {
+ "uuid": "d83af264-810f-4016-9e28-753783112935",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Open5GCore-2enb_nsd::OSM_CONFIG",
+ "configurable": null,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [],
+ "validFor": {
+ "endDateTime": "2041-08-16T20:00:24Z",
+ "startDateTime": "2021-08-16T20:00:24Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "d83af264-810f-4016-9e28-753783112935"
+ },
+ {
+ "uuid": "293b486c-d5cc-42f3-bc38-c176f9cdffff",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "image of Network Assistanse Server (NASS)",
+ "configurable": false,
+ "description": "image of Network Assistanse Server (NASS)",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "a6761857-effc-4bc3-934b-58299fa50e88",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2041-08-25T13:46:09Z",
+ "startDateTime": "2021-08-25T13:46:09Z"
+ },
+ "value": {
+ "value": "naas:latest",
+ "alias": "naas:latest"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:55:20Z",
+ "startDateTime": "2019-12-13T21:55:20Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "293b486c-d5cc-42f3-bc38-c176f9cdffff"
+ },
+ {
+ "uuid": "fd2e1b18-f107-4520-8205-8a42cea806d9",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Current active cameras",
+ "configurable": false,
+ "description": "measure current active cameras",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "INTEGER",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "00187fc9-9d5b-475d-81e1-dfc1ee2eeb29",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "INTEGER",
+ "validFor": {
+ "endDateTime": "2041-09-03T15:58:16Z",
+ "startDateTime": "2021-09-03T15:58:16Z"
+ },
+ "value": {
+ "value": "0",
+ "alias": null
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2041-09-03T15:57:36Z",
+ "startDateTime": "2021-09-03T15:57:36Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "fd2e1b18-f107-4520-8205-8a42cea806d9"
+ },
+ {
+ "uuid": "a81864cd-0f1f-4d04-a8ab-684b5d8fc972",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Number of reserved hours",
+ "configurable": true,
+ "description": "Number of reserved hours",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "SMALLINT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "771061ac-10ec-417d-a342-f2d76bbc949f",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "hour",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "SMALLINT",
+ "validFor": {
+ "endDateTime": "2039-12-13T21:55:14Z",
+ "startDateTime": "2019-12-13T21:55:14Z"
+ },
+ "value": {
+ "value": "2",
+ "alias": "2"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-13T21:54:30Z",
+ "startDateTime": "2019-12-13T21:54:30Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "a81864cd-0f1f-4d04-a8ab-684b5d8fc972"
+ },
+ {
+ "uuid": "bc3ddea0-d362-414f-9cc6-a0f2a2664e20",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "cirros_2vnf_nsd::Primitive::fsetup",
+ "configurable": true,
+ "description": null,
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 0,
+ "regex": null,
+ "valueType": "ARRAY",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "f3b91d34-90a7-4455-aca5-b40e1319058c",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2041-09-04T10:04:05Z",
+ "startDateTime": "2021-09-04T10:04:05Z"
+ },
+ "value": {
+ "value": "fsetup",
+ "alias": "primitive"
+ }
+ },
+ {
+ "uuid": "df6a846f-f934-4164-a3f5-e85fe2938064",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2041-09-04T10:04:05Z",
+ "startDateTime": "2021-09-04T10:04:05Z"
+ },
+ "value": {
+ "value": "{ \"tvg\": { \"ip\": \"\", \"channel1\": { \"mode\": \"0\" } } }",
+ "alias": "confjson"
+ }
+ },
+ {
+ "uuid": "747a1ffc-1b3a-4198-b627-b6e545e0d34f",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": null,
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "TEXT",
+ "validFor": {
+ "endDateTime": "2041-09-04T10:04:05Z",
+ "startDateTime": "2021-09-04T10:04:05Z"
+ },
+ "value": {
+ "value": "1",
+ "alias": "member_vnf_index"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2041-09-04T09:39:46Z",
+ "startDateTime": "2021-09-04T09:39:46Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "bc3ddea0-d362-414f-9cc6-a0f2a2664e20"
+ }
+ ],
+ "serviceSpecRelationship": [
+ {
+ "uuid": "4f7de502-b771-4df8-9b99-a0183e9489b5",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecRelationship",
+ "href": null,
+ "name": "Open5GCore-2enb_nsd",
+ "id": "2d2bd5b2-c4ef-44bb-8796-6360ae8f5581",
+ "relationshipType": null,
+ "role": null,
+ "validFor": null
+ }
+ ],
+ "targetServiceSchema": null,
+ "id": "0d5551e6-069f-43b7-aa71-10530f290239"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestService.json b/src/test/resources/TestService.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd7d494b133a4151253b2e377bbc660b5faa60f6
--- /dev/null
+++ b/src/test/resources/TestService.json
@@ -0,0 +1,57 @@
+{
+ "uuid" : "210553c3-359c-4843-a411-d9c3ee849d50",
+ "endDate" : null,
+ "startDate" : null,
+ "@baseType" : "BaseRootNamedEntity",
+ "@schemaLocation" : null,
+ "@type" : "ResourceFacingServiceSpecification",
+ "href" : null,
+ "name" : "cirros_2vnf_ns",
+ "id" : "210553c3-359c-4843-a411-d9c3ee849d50",
+ "category" : "ResourceFacingServiceSpecification",
+ "description" : "cirros_2vnf_ns",
+ "hasStarted" : false,
+ "isServiceEnabled" : false,
+ "isStateful" : null,
+ "serviceDate" : "2019-12-10T12:28:42.908Z",
+ "serviceType" : "cirros_2vnf_ns",
+ "startMode" : "1",
+ "note" : [ {
+ "uuid" : "daad782f-1a68-4cf9-8522-d07d9c8b3b63",
+ "@baseType" : "BaseEntity",
+ "@schemaLocation" : null,
+ "@type" : null,
+ "href" : null,
+ "author" : null,
+ "date" : null,
+ "system" : null,
+ "text" : "Service Created by OSOM:AutomationCheck"
+ } ],
+ "place" : [ ],
+ "relatedParty" : [ ],
+ "serviceCharacteristic" : [ ],
+ "serviceOrder" : [ {
+ "@baseType" : "BaseEntity",
+ "@schemaLocation" : null,
+ "@type" : null,
+ "href" : null,
+ "id" : "b9b81f7e-5bcb-471f-8044-32475c8cd5a2",
+ "serviceOrderItemId" : "79572492-977e-46fd-a9ca-fe7e1cb9ad20",
+ "@referredType" : null
+ } ],
+ "serviceRelationship" : [ ],
+ "serviceSpecification" : {
+ "@baseType" : "BaseEntity",
+ "@schemaLocation" : null,
+ "@type" : null,
+ "href" : null,
+ "name" : "A VINNI Service Example-Service Topology",
+ "version" : null,
+ "targetServiceSchema" : null,
+ "@referredType" : null,
+ "id" : "c00446ac-c8af-47ad-ac94-518d4bdd4c13"
+ },
+ "state" : "reserved",
+ "supportingResource" : [ ],
+ "supportingService" : [ ]
+}
\ No newline at end of file
diff --git a/src/test/resources/TestServiceNSD.json b/src/test/resources/TestServiceNSD.json
new file mode 100644
index 0000000000000000000000000000000000000000..7e2bcd6ab11a8824f201cd6f9523cd29c6784c2e
--- /dev/null
+++ b/src/test/resources/TestServiceNSD.json
@@ -0,0 +1,319 @@
+{
+ "uuid": "c00446ac-c8af-47ad-ac94-518d4bdd4c13",
+ "lastUpdate": "2019-12-30T18:33:43Z",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": "ResourceFacingServiceSpecification",
+ "href": null,
+ "name": "cirros_2vnf_nsd",
+ "description": "cirros_2vnf_ns",
+ "lifecycleStatus": "In study",
+ "version": "1.0",
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "isBundle": null,
+ "attachment": [],
+ "relatedParty": [],
+ "resourceSpecification": [
+ {
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef",
+ "href": null,
+ "name": "cirros_2vnf_nsd",
+ "version": "1.0",
+ "@referredType": null,
+ "id": "6f584ef4-9787-4af8-94b5-c319d7df4995"
+ }
+ ],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "3c03b224-0487-4a10-be21-59e7f8817dcf",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "PackagingFormat",
+ "configurable": false,
+ "description": "NSD PackagingFormat",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "b6eee9a4-cf0f-49d3-952a-d1380288fe0b",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "value": {
+ "value": "OSMvFIVE",
+ "alias": "PackagingFormat"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "3c03b224-0487-4a10-be21-59e7f8817dcf"
+ },
+ {
+ "uuid": "f415cee9-5543-441c-a0e5-5f1a9b1b15ee",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "NSDID",
+ "configurable": false,
+ "description": "NSD id",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "97ccb1e5-26f0-4cfc-a8d7-0e1b478a8016",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "value": {
+ "value": "3",
+ "alias": "id"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "f415cee9-5543-441c-a0e5-5f1a9b1b15ee"
+ },
+ {
+ "uuid": "b4d57f8e-fd29-4beb-9da4-26333f3bb963",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Vendor",
+ "configurable": false,
+ "description": "NSD Vendor",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "8588d23a-e8ce-48ae-a18a-2a663aa14f6a",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "value": {
+ "value": "OSM",
+ "alias": "Vendor"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "b4d57f8e-fd29-4beb-9da4-26333f3bb963"
+ },
+ {
+ "uuid": "7febc0ba-f63d-4442-9b0b-549680210614",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "OnBoardingStatus",
+ "configurable": false,
+ "description": "NSDtOnBoardingStatus",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "162b623b-9d64-4f0e-9a3f-978bd65f663d",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "value": {
+ "value": "FAILED",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "7febc0ba-f63d-4442-9b0b-549680210614"
+ },
+ {
+ "uuid": "6faf2d50-9af1-4544-bfd7-0b1e25b6a939",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "ObMANOprovider_Name",
+ "configurable": false,
+ "description": "NSD Onboarded MANO provider Name",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "e03d89f9-4446-4f0e-aab4-140b7f95e2e1",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "value": {
+ "value": "osm test",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "6faf2d50-9af1-4544-bfd7-0b1e25b6a939"
+ },
+ {
+ "uuid": "f459472b-c1ea-4d35-a1e9-dcbdc27e019e",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "PackageLocation",
+ "configurable": false,
+ "description": "NSD PackageLocation",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "8041c1f2-a95d-4f86-b410-ce1df498d8d0",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "value": {
+ "value": "/osapi/packages/cbc45a7a-55d5-4fa1-b32d-444256677f8f/cirros_2vnf_ns.tar.gz",
+ "alias": "PackageLocation"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2039-12-30T18:33:43Z",
+ "startDateTime": "2019-12-30T18:33:43Z"
+ },
+ "@valueSchemaLocation": null,
+ "id": "f459472b-c1ea-4d35-a1e9-dcbdc27e019e"
+ }
+ ],
+ "serviceSpecRelationship": [],
+ "targetServiceSchema": null,
+ "id": "c00446ac-c8af-47ad-ac94-518d4bdd4c13"
+}
\ No newline at end of file
diff --git a/src/test/resources/TestServiceOrderDates.json b/src/test/resources/TestServiceOrderDates.json
new file mode 100644
index 0000000000000000000000000000000000000000..53835b00ae84bb265395c2e6fd95784ffab6389e
--- /dev/null
+++ b/src/test/resources/TestServiceOrderDates.json
@@ -0,0 +1,150 @@
+{
+ "uuid": "93b9928c-de35-4495-a157-1100f6e71c92",
+ "orderDate": "2019-12-13T13:27:56Z",
+ "completionDate": null,
+ "expectedCompletionDate": null,
+ "requestedCompletionDate": "2039-12-13T13:27:49Z",
+ "requestedStartDate": "2039-12-13T13:27:49Z",
+ "startDate": "2039-12-13T13:27:49Z",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "ServiceOrder",
+ "href": null,
+ "id": "93b9928c-de35-4495-a157-1100f6e71c92",
+ "category": null,
+ "description": null,
+ "externalId": null,
+ "notificationContact": null,
+ "priority": null,
+ "note": [
+ {
+ "uuid": "1aa5412c-20eb-4266-91cc-95e5a9e464a7",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "author": "admin",
+ "date": null,
+ "system": null,
+ "text": "Note"
+ }
+ ],
+ "orderItem": [
+ {
+ "uuid": "5b08f277-c776-43c8-9834-8791de4124e6",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "id": "5b08f277-c776-43c8-9834-8791de4124e6",
+ "action": "add",
+ "orderItemRelationship": [
+ ],
+ "state": "INITIAL",
+ "service": {
+ "uuid": "cc344ee1-271b-4614-92f4-5f9d16524edc",
+ "serviceSpecification": {
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": null,
+ "version": null,
+ "targetServiceSchema": null,
+ "@referredType": null,
+ "id": "ce3afc23-1422-49e3-8475-f8965548f90b"
+ },
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": null,
+ "id": "cc344ee1-271b-4614-92f4-5f9d16524edc",
+ "category": null,
+ "serviceType": null,
+ "place": [
+ ],
+ "relatedParty": [
+ ],
+ "serviceCharacteristic": [
+ {
+ "uuid": "13f444e5-72ab-41d0-a651-8c51f72319cf",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "5G-VINNI Service Type",
+ "valueType": "SET",
+ "value": {
+ "value": "[{\"value\":\"1\",\"alias\":\"eMBB\"},{\"value\":\"3\",\"alias\":\"mIoT\"}]",
+ "alias": null
+ }
+ },
+ {
+ "uuid": "dc42c2a9-6957-4ddf-ae5b-23beec743725",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Delivery Time",
+ "valueType": "TIMESTAMP",
+ "value": {
+ "value": "2020-01-01T18:11:47Z",
+ "alias": "TimeStamp"
+ }
+ },
+ {
+ "uuid": "d59efa76-4dca-4fac-b6fc-28426b337d07",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Sticker Text",
+ "valueType": "TEXT",
+ "value": {
+ "value": "lorem ipsum dolor",
+ "alias": "FreeText"
+ }
+ },
+ {
+ "uuid": "3cba2460-7584-439b-a129-70b7cf9e6606",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "name": "Color",
+ "valueType": "ENUM",
+ "value": {
+ "value": "3",
+ "alias": "Black"
+ }
+ }
+ ],
+ "state": "feasibilityChecked",
+ "supportingResource": [
+ ],
+ "serviceRelationship": [
+ ],
+ "supportingService": [
+ ]
+ },
+ "appointment": null
+ }
+ ],
+ "orderRelationship": [
+ ],
+ "relatedParty": [
+ {
+ "uuid": "aa9da197-fc7d-4bd4-8eb3-a3a3297537ce",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.prm669.model.RelatedParty",
+ "href": null,
+ "name": "anonymousUser",
+ "role": "REQUESTER",
+ "@referredType": "SimpleUsername_Individual",
+ "id": "aa9da197-fc7d-4bd4-8eb3-a3a3297537ce"
+ }
+ ],
+ "state": "INPROGRESS"
+}
diff --git a/src/test/resources/cirros_2vnf_ns_RFS.json b/src/test/resources/cirros_2vnf_ns_RFS.json
new file mode 100644
index 0000000000000000000000000000000000000000..9e6b49f9abc24fb49e8b8c842591331980345e05
--- /dev/null
+++ b/src/test/resources/cirros_2vnf_ns_RFS.json
@@ -0,0 +1,507 @@
+{
+ "uuid": "99176116-17cf-464f-96f7-86e685914666",
+ "lastUpdate": "2020-09-24T18:10:10+03:00",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": "ResourceFacingServiceSpecification",
+ "href": null,
+ "name": "cirros_2vnf_ns",
+ "description": "cirros_2vnf_ns",
+ "lifecycleStatus": "In study",
+ "version": "1.0",
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "isBundle": false,
+ "attachment": [],
+ "relatedParty": [],
+ "resourceSpecification": [
+ {
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef",
+ "href": null,
+ "name": "cirros_2vnf_ns",
+ "version": "1.0",
+ "@referredType": null,
+ "id": "c17ff918-6776-47a7-ab5d-dad1969a36ed"
+ }
+ ],
+ "serviceLevelSpecification": [],
+ "serviceSpecCharacteristic": [
+ {
+ "uuid": "27bf9506-8bc7-4bfc-92f4-4d74828bac33",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "PackagingFormat",
+ "configurable": false,
+ "description": "NSD PackagingFormat",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "c63bbffb-fd9d-4f5c-8732-7b9a0e713fdb",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "GenericSOL005",
+ "alias": "PackagingFormat"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "27bf9506-8bc7-4bfc-92f4-4d74828bac33"
+ },
+ {
+ "uuid": "5164b2f0-43d8-4ffc-90ab-6ad920f370b6",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "OSM_CONFIG",
+ "configurable": false,
+ "description": "Initial config to OSM",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "bce5ede9-a115-4dbf-adb5-2f9519307a7b",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-24T18:10:10+03:00",
+ "startDateTime": "2020-09-24T18:10:10+03:00"
+ },
+ "value": {
+ "value": "{ \"nsdId\": \"0b6853fc-8219-4580-9697-bf4a8f0a08f9\", \"vimAccountId\": \"c224eb48-419e-4097-8a1d-11ec1bba087f\", \"wimAccountId\": false } ",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "5164b2f0-43d8-4ffc-90ab-6ad920f370b6"
+ },
+ {
+ "uuid": "0585110d-6c0d-4fff-8ed7-23043c305aa8",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "OnBoardingStatus",
+ "configurable": false,
+ "description": "NSDtOnBoardingStatus",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "6ca0d846-ecbd-41c1-8c9e-21091fd1382a",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "ONBOARDED",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "0585110d-6c0d-4fff-8ed7-23043c305aa8"
+ },
+ {
+ "uuid": "013948a4-383b-4d7c-9b5e-7e4310f26a5e",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "NSDID",
+ "configurable": false,
+ "description": "NSD id",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "979a76fd-5b1f-4ec5-ae85-42f2b5efadcd",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "33",
+ "alias": "id"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "013948a4-383b-4d7c-9b5e-7e4310f26a5e"
+ },
+ {
+ "uuid": "95c6e46f-2e6d-4370-8b0e-5e2fedfaa164",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "MemberVNFIndex_2",
+ "configurable": false,
+ "description": "Member VNF Index",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "5e169072-3534-4266-aff4-a90fa540c146",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "2",
+ "alias": "cirros_vnfd"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "95c6e46f-2e6d-4370-8b0e-5e2fedfaa164"
+ },
+ {
+ "uuid": "bd472024-b8b4-4b49-b0e9-4017032fdfa9",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "ObMANOprovider_Name",
+ "configurable": false,
+ "description": "NSD Onboarded MANO provider Name",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "290414ba-d0b0-4e3f-aa17-e6da5760515b",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "GenericSOL005",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "bd472024-b8b4-4b49-b0e9-4017032fdfa9"
+ },
+ {
+ "uuid": "3398011e-1fc8-4984-919b-43e134580617",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "MemberVNFIndex_1",
+ "configurable": false,
+ "description": "Member VNF Index",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "bc0e52eb-5182-4c3f-9a02-bba739df5ced",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "1",
+ "alias": "cirros_vnfd"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "3398011e-1fc8-4984-919b-43e134580617"
+ },
+ {
+ "uuid": "1c306799-9265-4e36-9fd0-b06e66cb378a",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "SSHKEY",
+ "configurable": false,
+ "description": "SSH public key",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "c8e2c7e1-7c8b-4538-a9e0-e74ef9c70f09",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "",
+ "alias": ""
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "1c306799-9265-4e36-9fd0-b06e66cb378a"
+ },
+ {
+ "uuid": "4456af26-a6fc-46f4-b84c-57e40848c71a",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "Vendor",
+ "configurable": false,
+ "description": "NSD Vendor",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "8d4fbf6d-d0fa-4621-81be-99f68a32e5a4",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "OSM",
+ "alias": "Vendor"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "4456af26-a6fc-46f4-b84c-57e40848c71a"
+ },
+ {
+ "uuid": "5c50dbe4-42f9-4d12-bed9-987c75b592d6",
+ "@baseType": "BaseRootEntity",
+ "@schemaLocation": null,
+ "@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
+ "href": null,
+ "name": "PackageLocation",
+ "configurable": false,
+ "description": "NSD PackageLocation",
+ "extensible": null,
+ "isUnique": null,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "TEXT",
+ "serviceSpecCharRelationship": [],
+ "serviceSpecCharacteristicValue": [
+ {
+ "uuid": "2ce00574-6d22-4f48-8bd4-17884f895c13",
+ "@baseType": "BaseEntity",
+ "@schemaLocation": null,
+ "@type": null,
+ "href": null,
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": null,
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "value": {
+ "value": "http://openslice-portalapi:13000/osapi/packages/5afddb42-9edc-40d0-9d9a-76a4621660db/cirros_2vnf_ns.tar.gz",
+ "alias": "PackageLocation"
+ }
+ }
+ ],
+ "validFor": {
+ "endDateTime": "2040-09-06T23:48:24+03:00",
+ "startDateTime": "2020-09-06T23:48:24+03:00"
+ },
+ "@valueSchemaLocation": null,
+ "id": "5c50dbe4-42f9-4d12-bed9-987c75b592d6"
+ }
+ ],
+ "serviceSpecRelationship": [],
+ "targetServiceSchema": null,
+ "id": "99176116-17cf-464f-96f7-86e685914666"
+}
\ No newline at end of file
diff --git a/src/test/resources/diagram.dmn b/src/test/resources/diagram.dmn
new file mode 100644
index 0000000000000000000000000000000000000000..2867afe5adf54ec191af5ba988f1da739ff39132
--- /dev/null
+++ b/src/test/resources/diagram.dmn
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ Uplink_throughput
+
+
+
+
+ video_definition
+
+
+
+
+
+
+ >= 3
+
+
+ <=2
+
+
+ '256'
+
+
+ 1024
+
+
+
+
+ < 3
+
+
+ >0
+
+
+ '192'
+
+
+ 512
+
+
+
+
+ >= 3
+
+
+ > 2
+
+
+ '1024'
+
+
+ 2048
+
+
+
+
+
diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e535939c74ad282638c06453b9938ac004463b39
--- /dev/null
+++ b/src/test/resources/logback-test.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/ondemand_decisions.dmn b/src/test/resources/ondemand_decisions.dmn
new file mode 100644
index 0000000000000000000000000000000000000000..93cbc4ab6e10876da2189a2905352ec11031b518
--- /dev/null
+++ b/src/test/resources/ondemand_decisions.dmn
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ cameras
+
+
+
+
+ video_definition
+
+
+
+
+
+
+ = 3]]>
+
+
+
+
+
+ '256'
+
+
+ 1024
+
+
+
+
+
+
+
+ =0]]>
+
+
+ '192'
+
+
+ 512
+
+
+
+
+ = 3]]>
+
+
+ 2]]>
+
+
+ '1024'
+
+
+ 2048
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/ondemand_decisions2.dmn b/src/test/resources/ondemand_decisions2.dmn
new file mode 100644
index 0000000000000000000000000000000000000000..85341c9ab46edbdea6ee3cc3484a95adca7b026e
--- /dev/null
+++ b/src/test/resources/ondemand_decisions2.dmn
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ cameras
+
+
+
+
+ video_definition
+
+
+
+
+
+
+ = 3]]>
+
+
+
+
+
+ '256'
+
+
+ 1024
+
+
+
+
+
+
+
+
+
+
+ '192'
+
+
+ 512
+
+
+
+
+ = 3]]>
+
+
+ 2]]>
+
+
+ '1024'
+
+
+ 2048
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/testResourceSpec.json b/src/test/resources/testResourceSpec.json
new file mode 100644
index 0000000000000000000000000000000000000000..6524bdb63ea380bd2ace697db00d1763eeb235a5
--- /dev/null
+++ b/src/test/resources/testResourceSpec.json
@@ -0,0 +1,45 @@
+{
+ "name": "Test Resource Spec",
+ "description": "Test Resource Spec example",
+ "version": "1.8.0",
+ "isBundle": false,
+ "attachment": [
+ ],
+ "relatedParty": [
+ ],
+ "resourceSpecCharacteristic": [
+ {
+ "name": "CoverageSpec",
+ "configurable": true,
+ "description": "This attribute specifies the coverage area of the network slice - the area where the terminals can access a particular network slice",
+ "extensible": null,
+ "isUnique": true,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "ENUM",
+ "resourceSpecCharRelationship": [
+ { "name": "Character Attribute", "relationshipType": "dependency" },
+ { "name": "Operational", "relationshipType": "dependency" },
+ { "name": "Scalability Attribute", "relationshipType": "dependency" },
+ { "name": "KPI", "relationshipType": "dependency" }
+ ],
+ "resourceSpecCharacteristicValue": [
+ {
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "SMALLINT",
+ "validFor": null,
+ "value": {
+ "value": "4",
+ "alias": "Local (outdoor)"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/test/resources/testServiceSpec.json b/src/test/resources/testServiceSpec.json
new file mode 100644
index 0000000000000000000000000000000000000000..bd1411c028c26356ebaa991961daad4000c4c0f0
--- /dev/null
+++ b/src/test/resources/testServiceSpec.json
@@ -0,0 +1,49 @@
+{
+ "name": "Test Spec",
+ "description": "Test Spec example",
+ "version": "1.8.0",
+ "isBundle": false,
+ "attachment": [
+ ],
+ "relatedParty": [
+ ],
+ "resourceSpecification": [
+ ],
+ "serviceLevelSpecification": [
+ ],
+ "serviceSpecCharacteristic": [
+ {
+ "name": "Coverage",
+ "configurable": true,
+ "description": "This attribute specifies the coverage area of the network slice - the area where the terminals can access a particular network slice",
+ "extensible": null,
+ "isUnique": true,
+ "maxCardinality": 1,
+ "minCardinality": 1,
+ "regex": null,
+ "valueType": "ENUM",
+ "serviceSpecCharRelationship": [
+ { "name": "Character Attribute", "role": "tag", "relationshipType": "dependency" },
+ { "name": "Operational", "role": "tag", "relationshipType": "dependency" },
+ { "name": "Scalability Attribute", "role": "tag", "relationshipType": "dependency" },
+ { "name": "KPI", "role": "tag", "relationshipType": "dependency" }
+ ],
+ "serviceSpecCharacteristicValue": [
+ {
+ "isDefault": true,
+ "rangeInterval": null,
+ "regex": null,
+ "unitOfMeasure": "N/A",
+ "valueFrom": null,
+ "valueTo": null,
+ "valueType": "SMALLINT",
+ "validFor": null,
+ "value": {
+ "value": "4",
+ "alias": "Local (outdoor)"
+ }
+ }
+ ]
+ }
+ ]
+}