From 7fc16e782950a0175eea0903cbb9e32e963d1aa8 Mon Sep 17 00:00:00 2001 From: Christos Tranoris <tranoris@ece.upatras.gr> Date: Mon, 6 Nov 2023 14:15:07 +0200 Subject: [PATCH] Initial commit --- .gitignore | 4 + pom.xml | 239 ++++++++++++++++++ .../ANSCreateInstanceRequestPayload.java | 36 +++ .../ANSInstantiateInstanceRequestPayload.java | 207 +++++++++++++++ .../osl/sol005nbi/ANSScaleRequestPayload.java | 163 ++++++++++++ .../org/etsi/osl/sol005nbi/OSMClient.java | 81 ++++++ .../osl/sol005nbi/OSMUtil/OSMNSExtractor.java | 35 +++ .../sol005nbi/OSMUtil/OSMVNFDExtractor.java | 34 +++ .../\316\221NSActionRequestPayload.java" | 155 ++++++++++++ 9 files changed, 954 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/org/etsi/osl/sol005nbi/ANSCreateInstanceRequestPayload.java create mode 100644 src/main/java/org/etsi/osl/sol005nbi/ANSInstantiateInstanceRequestPayload.java create mode 100644 src/main/java/org/etsi/osl/sol005nbi/ANSScaleRequestPayload.java create mode 100644 src/main/java/org/etsi/osl/sol005nbi/OSMClient.java create mode 100644 src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMNSExtractor.java create mode 100644 src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMVNFDExtractor.java create mode 100644 "src/main/java/org/etsi/osl/sol005nbi/\316\221NSActionRequestPayload.java" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bc3c3c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/target/ +/.project +/.classpath +/.settings diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..dd449d0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,239 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.etsi.osl.sol005nbi</groupId> + <artifactId>org.etsi.osl.sol005nbi.osm</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>org.etsi.osl.sol005nbi.osm</name> + + <organization> + <name>openslice.io</name> + <url>http://openslice.io</url> + </organization> + + <inceptionYear>2019</inceptionYear> + + <licenses> + <license> + <name>Apache 2.0</name> + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>repo</distribution> + <comments>A business-friendly OSS license</comments> + </license> + </licenses> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <salGeneratorPath>${project.build.directory}/generated-sources/mdsal-binding</salGeneratorPath> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven-license-plugin.version>2.0.0</maven-license-plugin.version> + <license.licenseName>apache_v2</license.licenseName> + <spring.boot-version>3.1.2</spring.boot-version> + </properties> + + <pluginRepositories> + <pluginRepository> + <id>opendaylight-release</id> + <name>opendaylight-release</name> + <url>https://nexus.opendaylight.org/content/repositories/opendaylight.release/</url> + </pluginRepository> + <pluginRepository> + <id>opendaylight-snapshot</id> + <name>opendaylight-snapshot</name> + <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url> + </pluginRepository> + </pluginRepositories> + + + <repositories> + <repository> + <id>opendaylight-release</id> + <name>opendaylight-release</name> + <url>https://nexus.opendaylight.org/content/repositories/opendaylight.release/</url> + </repository> + <repository> + <id>opendaylight-snapshot</id> + <name>opendaylight-snapshot</name> + <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url> + </repository> + </repositories> + + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yangtools-artifacts</artifactId> + <version>6.0.5</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <!-- Spring Boot BOM --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring.boot-version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <!-- Spring Boot --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>3.0.2</version> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-common</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>yang-binding</artifactId> + <version>0.13.1</version> + </dependency> + + + <!-- Dependencies for OSMClient START --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20160212</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jpa_2.0_spec</artifactId> + <version>1.1</version> + </dependency> + + <!-- Dependencies for OSMClient END --> + + <!-- Dependencies for OSMUtils START --> + <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.21</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-io</artifactId> + <version>1.3.2</version> + </dependency> + <!-- Dependencies for OSMUtils END --> + + </dependencies> + + <build> + <!-- https://bugs.opendaylight.org/show_bug.cgi?id=6252 --> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <!-- + <resource> + <directory>${project.build.directory}/generated-sources/spi</directory> + </resource> + <resource> + <directory>${project.build.directory}/generated-sources/yang</directory> + </resource> + --> + </resources> + + <!-- + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + --> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>17</source> + <target>17</target> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>license-maven-plugin</artifactId> + <version>${maven-license-plugin.version}</version> + <configuration> + <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage> + <processStartTag>========================LICENSE_START=================================</processStartTag> + <processEndTag>=========================LICENSE_END==================================</processEndTag> + <roots>src/main/java/io,src/main/java/OSM5NBIClient,src/main/java/OSM5Util</roots> + </configuration> + <executions> + <execution> + <id>generate-license-headers</id> + <goals> + <goal>update-file-header</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <licenseName>${license.licenseName}</licenseName> + + </configuration> + </execution> + <execution> + <id>download-licenses</id> + <goals> + <goal>download-licenses</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + </pluginManagement> + </build> + +</project> \ No newline at end of file diff --git a/src/main/java/org/etsi/osl/sol005nbi/ANSCreateInstanceRequestPayload.java b/src/main/java/org/etsi/osl/sol005nbi/ANSCreateInstanceRequestPayload.java new file mode 100644 index 0000000..5f238f3 --- /dev/null +++ b/src/main/java/org/etsi/osl/sol005nbi/ANSCreateInstanceRequestPayload.java @@ -0,0 +1,36 @@ +package org.etsi.osl.sol005nbi; +/*- + * ========================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================================== + */ + + +/** + * @author ctranoris + * + */ +public class ANSCreateInstanceRequestPayload extends ANSInstantiateInstanceRequestPayload +{ + private final String notificationType = "NsIdentifierCreationNotification"; + + public ANSCreateInstanceRequestPayload() + { + super(); + } +} + diff --git a/src/main/java/org/etsi/osl/sol005nbi/ANSInstantiateInstanceRequestPayload.java b/src/main/java/org/etsi/osl/sol005nbi/ANSInstantiateInstanceRequestPayload.java new file mode 100644 index 0000000..bf072e3 --- /dev/null +++ b/src/main/java/org/etsi/osl/sol005nbi/ANSInstantiateInstanceRequestPayload.java @@ -0,0 +1,207 @@ +package org.etsi.osl.sol005nbi; +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi + * %% + * 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================================== + */ + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ANSInstantiateInstanceRequestPayload +{ + private String nsName; + public String getNsName() { + return nsName; + } + + public void setNsName(String nsName) { + this.nsName = nsName; + } + + private String vimAccountId; + public String getVimAccountId() { + return vimAccountId; + } + + public void setVimAccountId(String vimAccountId) { + this.vimAccountId = vimAccountId; + } + + private Boolean wimAccountId; + public Boolean getWimAccountId() { + return wimAccountId; + } + + public void setWimAccountId(Boolean wimAccountId) { + this.wimAccountId = wimAccountId; + } + + + private String nsdId; + public String getNsdId() { + return nsdId; + } + + public void setNsdId(String nsdId) { + this.nsdId = nsdId; + } + + public class VnF + { + @JsonProperty("member-vnf-index") + private String memberVnFIndex; + public String getMemberVnFIndex() { + return memberVnFIndex; + } + public void setMemberVnFIndex(String memberVnFIndex) { + this.memberVnFIndex = memberVnFIndex; + } + @JsonProperty("vdu") + private List<Vdu> vdu = null; + + public List<Vdu> getVdu() { + return vdu; + } + public void setVdu(List<Vdu> vdu) { + this.vdu = vdu; + } + + @JsonProperty("vimAccountId") + private String vimAccount; + public String getVimAccount() { + return vimAccount; + } + public void setVimAccount(String vimAccount) { + this.vimAccount = vimAccount; + } + + public VnF() + { + + }; + } + + + public class Vdu + { + @JsonProperty("id") + private String id; + @JsonProperty("interface") + private ArrayList<NInterface> interfaceObj = null; + + public ArrayList<NInterface> getInterfaceObj() { + return interfaceObj; + } + public void setInterfaceObj(ArrayList<NInterface> interfaceObj) { + this.interfaceObj = interfaceObj; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + } + + public class NInterface + { + @JsonProperty("name") + private String name; + @JsonProperty("floating-ip-required") + private Boolean floating_ip_required; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Boolean getFloating_ip_required() { + return floating_ip_required; + } + public void setFloating_ip_required(Boolean floating_ip_required) { + this.floating_ip_required = floating_ip_required; + } + } + + class Vld + { + @JsonProperty("name") + private String name; + @JsonProperty("vim-network-name") + private LinkedHashMap<String,String> vimNetworkName = new LinkedHashMap<>(); + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public LinkedHashMap<String, String> getVimNetworkName() { + return vimNetworkName; + } + public void setVimNetworkName(LinkedHashMap<String, String> vimNetworkName) { + this.vimNetworkName = vimNetworkName; + } +// private String vimNetworkName; +// public String getVimNetworkName() { +// return vimNetworkName; +// } +// public void setVimNetworkName(String vimNetworkName) { +// this.vimNetworkName = vimNetworkName; +// } + } + private List<VnF> vnf = new ArrayList<>(); + public List<VnF> getVnf() { + return vnf; + } + + public void setVnf(List<VnF> vnf) { + this.vnf = vnf; + } + + private List<Vld> vld = new ArrayList<>(); + + public List<Vld> getVld() { + return vld; + } + + public void setVld(List<Vld> vld) { + this.vld = vld; + } + + 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/sol005nbi/ANSScaleRequestPayload.java b/src/main/java/org/etsi/osl/sol005nbi/ANSScaleRequestPayload.java new file mode 100644 index 0000000..7399287 --- /dev/null +++ b/src/main/java/org/etsi/osl/sol005nbi/ANSScaleRequestPayload.java @@ -0,0 +1,163 @@ +/*- + * ========================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.sol005nbi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author Ioannis Chatzis + * + */ + +enum ScaleVnfType {SCALE_OUT, SCALE_IN}; + +public class ANSScaleRequestPayload +{ + public class ScaleVnfData + { + public class ScaleByStepData + { + @JsonProperty("scaling-group-descriptor") + private String scaling_group_descriptor; + @JsonProperty("member-vnf-index") + private String member_vnf_index; + @JsonProperty("scaling-policy") + private String scaling_policy; + + public String getScaling_group_descriptor() { + return scaling_group_descriptor; + } + public void setScaling_group_descriptor(String scaling_group_descriptor) { + this.scaling_group_descriptor = scaling_group_descriptor; + } + 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 getScaling_policy() { + return scaling_policy; + } + public void setScaling_policy(String scaling_policy) { + this.scaling_policy = scaling_policy; + } + } + + private String scaleVnfType; + private String vnfInstanceId; + private ScaleByStepData scaleByStepData = new ScaleByStepData(); + + public String getVnfInstanceId() { + return vnfInstanceId; + } + public ScaleByStepData getScaleByStepData() { + return scaleByStepData; + } + public void setScaleByStepData(ScaleByStepData scaleByStepData) { + this.scaleByStepData = scaleByStepData; + } + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + public String getScaleVnfType() { + return scaleVnfType; + } + public void setScaleVnfType(String scaleVnfType) { + this.scaleVnfType = scaleVnfType; + } + + } + + private String lcmOperationType; //"lcmOperationType": "scale" + private String nsInstanceId; + private String scaleType; + @JsonProperty("timeout-ns-scale") + private String timeout_ns_scale; + private ScaleVnfData scaleVnfData = new ScaleVnfData(); + private String scaleTime; + + 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 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; + } + + public String getScaleType() { + return scaleType; + } + + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public String getTimeout_ns_scale() { + return timeout_ns_scale; + } + + public void setTimeout_ns_scale(String timeout_ns_scale) { + this.timeout_ns_scale = timeout_ns_scale; + } + + public ScaleVnfData getScaleVnfData() { + return scaleVnfData; + } + + public void setScaleVnfData(ScaleVnfData scaleVnfData) { + this.scaleVnfData = scaleVnfData; + } + + public String getScaleTime() { + return scaleTime; + } + + public void setScaleTime(String scaleTime) { + this.scaleTime = scaleTime; + } +} + diff --git a/src/main/java/org/etsi/osl/sol005nbi/OSMClient.java b/src/main/java/org/etsi/osl/sol005nbi/OSMClient.java new file mode 100644 index 0000000..d68e66a --- /dev/null +++ b/src/main/java/org/etsi/osl/sol005nbi/OSMClient.java @@ -0,0 +1,81 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.osm + * %% + * 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.sol005nbi; + +import java.io.IOException; + +import org.json.JSONObject; +import org.springframework.http.ResponseEntity; + +public interface OSMClient { + + String getMANOApiEndpoint(); + + JSONObject getNSInstanceInfo(String instanceId); + + JSONObject getVNFInstanceInfo(String instanceId); + + JSONObject getNSInstanceContentInfo(String instanceId); + + JSONObject getNSLCMDetails(String nsLcmOpOccId); + + ResponseEntity<String> getNSLCMDetailsList(); + + String getNSLCMDetailsListByNSID(String nsid); + + ResponseEntity<String> createVNFDPackage(); + + ResponseEntity<String> deleteVNFDPackage(String vnfd_id); + + ResponseEntity<String> uploadVNFDPackageContent(String vnfd_id, String pLocation) throws IOException; + + ResponseEntity<String> uploadVNFDPackageContent(String vnfd_id, byte[] allBytes) throws IOException; + + ResponseEntity<String> createNSDPackage(); + + ResponseEntity<String> uploadNSDPackageContent(String nsd_id, String pLocation) throws IOException; + + ResponseEntity<String> uploadNSDPackageContent(String nsd_id, byte[] allBytes) throws IOException; + + ResponseEntity<String> deleteNSDPackage(String nsd_id); + + ResponseEntity<String> getVNFInstanceInfoNew(String string); + + ResponseEntity<String> createNSInstance(String json); + + ResponseEntity<String> instantiateNSInstance(String nsd_instance_id, String json); + + ResponseEntity<String> deleteNSInstanceNew(String instanceId, boolean force); + + ResponseEntity<String> terminateNSInstanceNew(String instanceId); + + ResponseEntity<String> actionNSInstance(String ns_instance_id, String payload); + + ResponseEntity<String> scaleNSInstance(String ns_instance_id, String payload); + + ResponseEntity<String> getVIMs(); + + ResponseEntity<String> getVNFDescriptorsList(); + + ResponseEntity<String> getNSDescriptorsList(); + + ResponseEntity<String> getNSInstancesList(); + +} diff --git a/src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMNSExtractor.java b/src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMNSExtractor.java new file mode 100644 index 0000000..fe80f80 --- /dev/null +++ b/src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMNSExtractor.java @@ -0,0 +1,35 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.osm5 + * %% + * 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.sol005nbi.OSMUtil; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +public interface OSMNSExtractor { + + public Object extractNsDescriptor() throws IOException ; + + public String getDescriptorYAMLfile() ; + + public void setDescriptorYAMLfile(String descriptorYAMLfile) ; + + public ByteArrayOutputStream getIconfilePath() ; + +} diff --git a/src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMVNFDExtractor.java b/src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMVNFDExtractor.java new file mode 100644 index 0000000..aa0ef91 --- /dev/null +++ b/src/main/java/org/etsi/osl/sol005nbi/OSMUtil/OSMVNFDExtractor.java @@ -0,0 +1,34 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.osm5 + * %% + * 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.sol005nbi.OSMUtil; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +public interface OSMVNFDExtractor { + + Object extractVnfdDescriptor() throws IOException ; + + public String getDescriptorYAMLfile() ; + + public void setDescriptorYAMLfile(String descriptorYAMLfile) ; + + public ByteArrayOutputStream getIconfilePath() ; +} diff --git "a/src/main/java/org/etsi/osl/sol005nbi/\316\221NSActionRequestPayload.java" "b/src/main/java/org/etsi/osl/sol005nbi/\316\221NSActionRequestPayload.java" new file mode 100644 index 0000000..59de200 --- /dev/null +++ "b/src/main/java/org/etsi/osl/sol005nbi/\316\221NSActionRequestPayload.java" @@ -0,0 +1,155 @@ +package org.etsi.osl.sol005nbi; +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.sol005nbi.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================================== + */ + +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<String, Object> primitive_params = new LinkedHashMap<>(); + + public Map<String, Object> getPrimitive_params() { + return primitive_params; + } + + @JsonAnySetter + public void setPrimitive_params(Map<String, Object> 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; + } +} + -- GitLab