summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenes Nemeth <denes.nemeth@nokia.com>2018-03-03 11:44:14 +0100
committerDenes Nemeth <denes.nemeth@nokia.com>2018-03-03 11:44:14 +0100
commitc13b3688cd0bc63954c78819fe4bad148c8ac2a3 (patch)
tree11bf76b9c11bc0bfaff2bfdf9cd28e96c12c6a20
parent4d24e40338421555cad5cd5f9691894a1eb15843 (diff)
Fix CP handling
Change-Id: I8105b4a8e9bb56b52a1cd6af4991cf1eb023f953 Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com> Issue-ID: VFC-728
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/api/INotificationSender.java1
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java60
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/ReportedAffectedCp.java21
-rw-r--r--nokiav2/driver/src/main/resources/cbam.collectConnectionPoints.js16
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcNotificationSender.java28
-rw-r--r--nokiav2/generatedapis/pom.xml6
-rw-r--r--nokiav2/generatedapis/src/main/resources/patch183
-rw-r--r--nokiav2/generatortools/pom.xml35
-rw-r--r--nokiav2/generatortools/src/main/java/com/nokia/cbam/swagger/CbamJavaClientCodegen.java85
-rw-r--r--nokiav2/pom.xml1
10 files changed, 64 insertions, 372 deletions
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/api/INotificationSender.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/api/INotificationSender.java
index 92099cc3..241e5de6 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/api/INotificationSender.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/api/INotificationSender.java
@@ -33,4 +33,5 @@ public interface INotificationSender {
* @param vimId the identifier of the VIM in ONAP
*/
void processNotification(VnfLifecycleChangeNotification receivedNotification, OperationExecution operationExecution, ReportedAffectedConnectionPoints affectedConnectionPoints, String vimId);
+
}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java
index 26439b5c..98b9a22f 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java
@@ -15,6 +15,7 @@
*/
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc;
+import com.google.common.base.Optional;
import com.google.gson.Gson;
import com.nokia.cbam.lcm.v32.model.OperationExecution;
import com.nokia.cbam.lcm.v32.model.ScaleVnfRequest;
@@ -33,6 +34,8 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
+import static com.google.common.base.Optional.of;
+import static com.google.common.collect.Iterables.tryFind;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.fatalFailure;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.ILifecycleChangeNotificationManager.SEPARATOR;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.JobManager.extractOnapJobId;
@@ -84,7 +87,7 @@ public class VfcNotificationSender implements INotificationSender {
}
}
- private AffectedCp buildAffectedCp(String vimId, String vnfId, ReportedAffectedCp affectedCp) {
+ private AffectedCp buildAffectedCp(String vimId, String vnfId, VnfCpNotificationType changeType, ReportedAffectedCp affectedCp) {
AffectedCp onapAffectedCp = new AffectedCp();
AffectedCpPortResource port = new AffectedCpPortResource();
port.setInstId(affectedCp.getServerProviderId());
@@ -98,21 +101,11 @@ public class VfcNotificationSender implements INotificationSender {
onapAffectedCp.setCpdid(affectedCp.getCpId());
onapAffectedCp.setCpinstanceid(vnfId + SEPARATOR + affectedCp.getCpId());
onapAffectedCp.setVirtualLinkInstanceId(affectedCp.getNetworkProviderId());
- onapAffectedCp.setChangeType(transform(affectedCp.getChangeType()));
+ onapAffectedCp.setChangeType(changeType);
//owner id & type can be left empty it will default to VNF id on VF-C
return onapAffectedCp;
}
- private VnfCpNotificationType transform(com.nokia.cbam.lcm.v32.model.ChangeType changeType) {
- switch (changeType) {
- case ADDED:
- return VnfCpNotificationType.ADDED;
- case REMOVED:
- return VnfCpNotificationType.REMOVED;
- default: //can only be MODIFIED
- return VnfCpNotificationType.CHANGED;
- }
- }
private void addAffectedVnfcs(String vimId, String vnfId, VNFLCMNotification notificationToSend, VnfLifecycleChangeNotification request) {
if (request.getAffectedVnfcs() != null) {
@@ -147,24 +140,49 @@ public class VfcNotificationSender implements INotificationSender {
}
}
+ private Optional<VnfCpNotificationType> getChangeType(ReportedAffectedConnectionPoints affectedCps, ReportedAffectedCp affectedCp) {
+ Optional<ReportedAffectedCp> cpBeforeOperation = tryFind(affectedCps.getPre(), pre -> affectedCp.getCpId().equals(pre.getCpId()));
+ Optional<ReportedAffectedCp> cpAfterOperation = tryFind(affectedCps.getPost(), post -> affectedCp.getCpId().equals(post.getCpId()));
+ if(cpBeforeOperation.isPresent() && cpAfterOperation.isPresent()){
+ return cpAfterOperation.get().equals(cpBeforeOperation.get()) ? Optional.absent() : of(VnfCpNotificationType.CHANGED);
+ }
+ else{
+ //the affected CP must be present in the pre or post
+ return of((cpAfterOperation.isPresent() ? VnfCpNotificationType.ADDED : VnfCpNotificationType.REMOVED));
+ }
+ }
+
private void addAffectedCps(String vimId, VNFLCMNotification notificationToSend, ReportedAffectedConnectionPoints affectedCps) {
if (affectedCps != null) {
notificationToSend.setAffectedCp(new ArrayList<>());
- for (ReportedAffectedCp affectedCp : affectedCps.getPost()) {
- if (affectedCp.getCpdId() != null) {
- AffectedCp onapAffectedCp = buildAffectedCp(vimId, notificationToSend.getVnfInstanceId(), affectedCp);
- onapAffectedCp.setCpdid(affectedCp.getCpdId());
- notificationToSend.getAffectedCp().add(onapAffectedCp);
+ for (ReportedAffectedCp pre : affectedCps.getPre()) {
+ Optional<VnfCpNotificationType> changeType = getChangeType(affectedCps, pre);
+ if(of(VnfCpNotificationType.REMOVED).equals(changeType)){
+ addModifiedCp(vimId, notificationToSend, pre, changeType);
}
- if (affectedCp.getEcpdId() != null) {
- AffectedCp onapAffectedCp = buildAffectedCp(vimId, notificationToSend.getVnfInstanceId(), affectedCp);
- onapAffectedCp.setCpdid(affectedCp.getEcpdId());
- notificationToSend.getAffectedCp().add(onapAffectedCp);
+ }
+ for (ReportedAffectedCp post : affectedCps.getPost()) {
+ Optional<VnfCpNotificationType> changeType = getChangeType(affectedCps, post);
+ if(of(VnfCpNotificationType.ADDED).equals(changeType) || of(VnfCpNotificationType.CHANGED).equals(changeType)){
+ addModifiedCp(vimId, notificationToSend, post, changeType);
}
}
}
}
+ private void addModifiedCp(String vimId, VNFLCMNotification notificationToSend, ReportedAffectedCp post, Optional<VnfCpNotificationType> changeType) {
+ if (post.getCpdId() != null) {
+ AffectedCp onapAffectedCp = buildAffectedCp(vimId, notificationToSend.getVnfInstanceId(), changeType.get(), post);
+ onapAffectedCp.setCpdid(post.getCpdId());
+ notificationToSend.getAffectedCp().add(onapAffectedCp);
+ }
+ if (post.getEcpdId() != null) {
+ AffectedCp onapAffectedCp = buildAffectedCp(vimId, notificationToSend.getVnfInstanceId(), changeType.get(), post);
+ onapAffectedCp.setCpdid(post.getEcpdId());
+ notificationToSend.getAffectedCp().add(onapAffectedCp);
+ }
+ }
+
private org.onap.vnfmdriver.model.OperationType getOperation(String vnfmId, String vnfId, OperationExecution operationExecution, com.nokia.cbam.lcm.v32.model.OperationType type, List<com.nokia.cbam.lcm.v32.model.AffectedVnfc> affectedVnfcs) {
switch (type) {
case TERMINATE:
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/ReportedAffectedCp.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/ReportedAffectedCp.java
index ab9d6314..6d265c60 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/ReportedAffectedCp.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/ReportedAffectedCp.java
@@ -33,7 +33,6 @@ public class ReportedAffectedCp {
private String serverProviderId;
private String name;
private String networkProviderId;
- private ChangeType changeType;
/**
* @return the provider id of the port
@@ -175,20 +174,6 @@ public class ReportedAffectedCp {
this.networkProviderId = networkProviderId;
}
- /**
- * @return the state of the port in the current operation
- */
- public ChangeType getChangeType() {
- return changeType;
- }
-
- /**
- * @param changeType the state of the port in the current operation
- */
- public void setChangeType(ChangeType changeType) {
- this.changeType = changeType;
- }
-
@Override
public String toString() {
return "ReportedAffectedCp{" +
@@ -202,7 +187,6 @@ public class ReportedAffectedCp {
", serverProviderId='" + serverProviderId + '\'' +
", name='" + name + '\'' +
", networkProviderId='" + networkProviderId + '\'' +
- ", changeType=" + changeType +
'}';
}
@@ -220,12 +204,11 @@ public class ReportedAffectedCp {
Objects.equals(macAddress, that.macAddress) &&
Objects.equals(serverProviderId, that.serverProviderId) &&
Objects.equals(name, that.name) &&
- Objects.equals(networkProviderId, that.networkProviderId) &&
- changeType == that.changeType;
+ Objects.equals(networkProviderId, that.networkProviderId);
}
@Override
public int hashCode() {
- return Objects.hash(providerId, cpdId, ecpdId, cpId, tenantId, ipAddress, macAddress, serverProviderId, name, networkProviderId, changeType);
+ return Objects.hash(providerId, cpdId, ecpdId, cpId, tenantId, ipAddress, macAddress, serverProviderId, name, networkProviderId);
}
} \ No newline at end of file
diff --git a/nokiav2/driver/src/main/resources/cbam.collectConnectionPoints.js b/nokiav2/driver/src/main/resources/cbam.collectConnectionPoints.js
index f5cfc675..c721c935 100644
--- a/nokiav2/driver/src/main/resources/cbam.collectConnectionPoints.js
+++ b/nokiav2/driver/src/main/resources/cbam.collectConnectionPoints.js
@@ -26,21 +26,7 @@ function collectPorts(resourceModel, diff){
transformedPort.macAddress = port.attributes.mac_address;
transformedPort.serverProviderId = port.attributes.device_id;
transformedPort.networkProviderId = port.attributes.network_id;
- transformedPort.changeType = 'untouched';
- var added = contains(diff.add, path);
- var removed = contains(diff.remove, path);
- if(added && removed){
- transformedPort.changeType = "MODIFIED";
- }
- else{
- if(removed){
- transformedPort.changeType = "REMOVED";
- }
- if(added){
- transformedPort.changeType = "ADDED";
- }
- }
- if('untouched' != transformedPort.changeType && managedPort){
+ if(managedPort){
transformedPorts.push(transformedPort)
}
})
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcNotificationSender.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcNotificationSender.java
index 42906c7b..008d8272 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcNotificationSender.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcNotificationSender.java
@@ -171,7 +171,6 @@ public class TestVfcNotificationSender extends TestBase {
ReportedAffectedConnectionPoints affectedConnectionPoints = new ReportedAffectedConnectionPoints();
ReportedAffectedCp affectedCp = new ReportedAffectedCp();
- affectedCp.setChangeType(ChangeType.ADDED);
affectedCp.setCpdId("cpVnfdId");
affectedCp.setIpAddress("1.2.3.4");
affectedCp.setMacAddress("myMac");
@@ -255,7 +254,6 @@ public class TestVfcNotificationSender extends TestBase {
ReportedAffectedConnectionPoints affectedConnectionPoints = new ReportedAffectedConnectionPoints();
ReportedAffectedCp affectedCp = new ReportedAffectedCp();
- affectedCp.setChangeType(ChangeType.ADDED);
//affectedCp.setCpdId("cpVnfdId");
affectedCp.setIpAddress("1.2.3.4");
affectedCp.setMacAddress("myMac");
@@ -336,7 +334,6 @@ public class TestVfcNotificationSender extends TestBase {
ReportedAffectedConnectionPoints affectedConnectionPoints = new ReportedAffectedConnectionPoints();
ReportedAffectedCp affectedCp = new ReportedAffectedCp();
- affectedCp.setChangeType(ChangeType.REMOVED);
affectedCp.setCpdId("cpVnfdId");
affectedCp.setIpAddress("1.2.3.4");
affectedCp.setMacAddress("myMac");
@@ -348,7 +345,7 @@ public class TestVfcNotificationSender extends TestBase {
affectedCp.setProviderId("portProviderId");
affectedCp.setServerProviderId("serverProviderId");
affectedCp.setTenantId("tenantId");
- affectedConnectionPoints.getPost().add(affectedCp);
+ affectedConnectionPoints.getPre().add(affectedCp);
OperationResult operationResult = new OperationResult();
operationResult.operationResult = affectedConnectionPoints;
@@ -443,7 +440,6 @@ public class TestVfcNotificationSender extends TestBase {
ReportedAffectedConnectionPoints affectedConnectionPoints = new ReportedAffectedConnectionPoints();
ReportedAffectedCp affectedCp = new ReportedAffectedCp();
- affectedCp.setChangeType(ChangeType.MODIFIED);
affectedCp.setCpdId("cpVnfdId");
affectedCp.setIpAddress("1.2.3.4");
affectedCp.setMacAddress("myMac");
@@ -455,7 +451,21 @@ public class TestVfcNotificationSender extends TestBase {
affectedCp.setProviderId("portProviderId");
affectedCp.setServerProviderId("serverProviderId");
affectedCp.setTenantId("tenantId");
- affectedConnectionPoints.getPost().add(affectedCp);
+ affectedConnectionPoints.getPre().add(affectedCp);
+
+ ReportedAffectedCp after = new ReportedAffectedCp();
+ after.setCpdId("cpVnfdId");
+ after.setIpAddress("1.2.3.5");
+ after.setMacAddress("myMac");
+ after.setName("myPortName");
+ after.setCpId("cpId");
+
+ // affectedCp.setEcpdId("ecpdId");
+ after.setNetworkProviderId("networkProviderId");
+ after.setProviderId("portProviderId");
+ after.setServerProviderId("serverProviderId");
+ after.setTenantId("tenantId");
+ affectedConnectionPoints.getPost().add(after);
OperationResult operationResult = new OperationResult();
@@ -491,7 +501,7 @@ public class TestVfcNotificationSender extends TestBase {
assertEquals(null, actualAffectedCp.getOwnerId());
assertEquals(null, actualAffectedCp.getOwnerType());
assertEquals("networkProviderId", actualAffectedCp.getVirtualLinkInstanceId());
- assertEquals("1.2.3.4", actualAffectedCp.getPortResource().getIpAddress());
+ assertEquals("1.2.3.5", actualAffectedCp.getPortResource().getIpAddress());
assertEquals("myMac", actualAffectedCp.getPortResource().getMacAddress());
assertEquals("tenantId", actualAffectedCp.getPortResource().getTenant());
assertEquals(VIM_ID, actualAffectedCp.getPortResource().getVimid());
@@ -557,7 +567,6 @@ public class TestVfcNotificationSender extends TestBase {
ReportedAffectedConnectionPoints affectedConnectionPoints = new ReportedAffectedConnectionPoints();
ReportedAffectedCp affectedCp = new ReportedAffectedCp();
- affectedCp.setChangeType(ChangeType.ADDED);
affectedCp.setCpdId("cpVnfdId");
affectedCp.setIpAddress("1.2.3.4");
affectedCp.setMacAddress("myMac");
@@ -669,7 +678,6 @@ public class TestVfcNotificationSender extends TestBase {
ReportedAffectedConnectionPoints affectedConnectionPoints = new ReportedAffectedConnectionPoints();
ReportedAffectedCp affectedCp = new ReportedAffectedCp();
- affectedCp.setChangeType(ChangeType.REMOVED);
affectedCp.setCpdId("cpVnfdId");
affectedCp.setIpAddress("1.2.3.4");
affectedCp.setMacAddress("myMac");
@@ -681,7 +689,7 @@ public class TestVfcNotificationSender extends TestBase {
affectedCp.setProviderId("portProviderId");
affectedCp.setServerProviderId("serverProviderId");
affectedCp.setTenantId("tenantId");
- affectedConnectionPoints.getPost().add(affectedCp);
+ affectedConnectionPoints.getPre().add(affectedCp);
OperationResult operationResult = new OperationResult();
diff --git a/nokiav2/generatedapis/pom.xml b/nokiav2/generatedapis/pom.xml
index be2dc46f..3dfeba34 100644
--- a/nokiav2/generatedapis/pom.xml
+++ b/nokiav2/generatedapis/pom.xml
@@ -40,7 +40,7 @@
</goals>
<configuration>
<inputSpec>${basedir}/src/main/resources/nokia.vnfm.api.v3.lcm.json</inputSpec>
- <language>com.nokia.cbam.swagger.CbamJavaClientCodegen</language>
+ <language>java</language>
<output>${project.build.directory}/generated-sources/cbam</output>
<apiPackage>com.nokia.cbam.lcm.v32.api</apiPackage>
<modelPackage>com.nokia.cbam.lcm.v32.model</modelPackage>
@@ -59,7 +59,7 @@
</goals>
<configuration>
<inputSpec>${basedir}/src/main/resources/nokia.vnfm.api.v3.lcn.subscription.json</inputSpec>
- <language>com.nokia.cbam.swagger.CbamJavaClientCodegen</language>
+ <language>java</language>
<output>${project.build.directory}/generated-sources/cbam</output>
<apiPackage>com.nokia.cbam.lcn.v32.api</apiPackage>
<modelPackage>com.nokia.cbam.lcn.v32.model</modelPackage>
@@ -76,7 +76,7 @@
</goals>
<configuration>
<inputSpec>${basedir}/src/main/resources/nokia.catalog.json</inputSpec>
- <language>com.nokia.cbam.swagger.CbamJavaClientCodegen</language>
+ <language>java</language>
<output>${project.build.directory}/generated-sources/cbam</output>
<apiPackage>com.nokia.cbam.catalog.v1.api</apiPackage>
<modelPackage>com.nokia.cbam.catalog.v1.model</modelPackage>
diff --git a/nokiav2/generatedapis/src/main/resources/patch b/nokiav2/generatedapis/src/main/resources/patch
index e19dd1a0..562c7a1d 100644
--- a/nokiav2/generatedapis/src/main/resources/patch
+++ b/nokiav2/generatedapis/src/main/resources/patch
@@ -1,186 +1,3 @@
-diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java
---- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java 2018-02-19 17:32:34.000000000 +0100
-+++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/JSON.java 2018-02-19 17:34:43.000000000 +0100
-@@ -13,14 +13,12 @@
-
- package com.nokia.cbam.lcm.v32;
-
--import com.google.gson.Gson;
--import com.google.gson.GsonBuilder;
--import com.google.gson.JsonParseException;
--import com.google.gson.TypeAdapter;
-+import com.google.gson.*;
-+import com.google.gson.internal.Streams;
- import com.google.gson.internal.bind.util.ISO8601Utils;
- import com.google.gson.stream.JsonReader;
-+import com.google.gson.stream.JsonToken;
- import com.google.gson.stream.JsonWriter;
--import com.google.gson.JsonElement;
- import io.gsonfire.GsonFireBuilder;
- import io.gsonfire.TypeSelector;
- import org.threeten.bp.LocalDate;
-@@ -46,6 +44,8 @@
- private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
- private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter();
- private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter();
-+ private VimInfoTypeAdapter vimInfoTypeAdapter = new VimInfoTypeAdapter();
-+ private LcnAdapter lcnAdapter = new LcnAdapter();
-
- public static GsonBuilder createGson() {
- GsonFireBuilder fireBuilder = new GsonFireBuilder()
-@@ -75,6 +75,8 @@
- .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter)
- .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
- .registerTypeAdapter(LocalDate.class, localDateTypeAdapter)
-+ .registerTypeAdapter(VimInfo.class, vimInfoTypeAdapter)
-+ .registerTypeAdapter(AbstractVnfNotification.class, lcnAdapter)
- .create();
- }
-
-@@ -349,6 +351,67 @@
- }
- }
-
-+ static abstract class AbstractTypeAdapter<T> extends TypeAdapter<T>{
-+
-+ @Override
-+ public void write(JsonWriter out, T value) throws IOException {
-+ out.jsonValue(new Gson().toJson(value));
-+ }
-+
-+ @Override
-+ public T read(JsonReader in) throws IOException {
-+ switch (in.peek()) {
-+ case NULL:
-+ in.nextNull();
-+ return null;
-+ default:
-+ JsonElement object = Streams.parse(in);
-+ String type = object.getAsJsonObject().get(getTypeField()).getAsString();
-+ Type typeOfT = getTypeMap().get(type);
-+ return new Gson().fromJson(object, typeOfT);
-+ }
-+ }
-+
-+ abstract protected String getTypeField();
-+ abstract protected Map<String, Type> getTypeMap();
-+
-+ }
-+
-+ public static class VimInfoTypeAdapter extends AbstractTypeAdapter<VimInfo> {
-+
-+ @Override
-+ protected String getTypeField() {
-+ return "vimInfoType";
-+ }
-+
-+ @Override
-+ protected Map<String, Type> getTypeMap() {
-+ Map<String,Type> myMap = new HashMap<String,Type>();
-+ myMap.put(VimInfo.VimInfoTypeEnum.OPENSTACK_V2_INFO.name(), OPENSTACKV2INFO.class);
-+ myMap.put(VimInfo.VimInfoTypeEnum.OPENSTACK_V3_INFO.name(), OPENSTACKV3INFO.class);
-+ myMap.put(VimInfo.VimInfoTypeEnum.VMWARE_VCLOUD_INFO.name(), VMWAREVCLOUDINFO.class);
-+ return myMap;
-+ }
-+ }
-+
-+ public static class LcnAdapter extends AbstractTypeAdapter<AbstractVnfNotification>{
-+ @Override
-+ protected String getTypeField() {
-+ return "notificationType";
-+ }
-+
-+ @Override
-+ protected Map<String, Type> getTypeMap() {
-+ Map<String,Type> myMap = new HashMap<String,Type>();
-+ myMap.put(VnfNotificationType.VNFIDENTIFIERCREATIONNOTIFICATION.name(), VnfIdentifierCreationNotification.class);
-+ myMap.put(VnfNotificationType.VNFIDENTIFIERDELETIONNOTIFICATION.name(), VnfIdentifierDeletionNotification.class);
-+ myMap.put(VnfNotificationType.VNFINFOATTRIBUTEVALUECHANGENOTIFICATION.name(), VnfInfoAttributeValueChangeNotification.class);
-+ myMap.put(VnfNotificationType.VNFLIFECYCLECHANGENOTIFICATION.name(), VnfLifecycleChangeNotification.class);
-+ myMap.put(VnfNotificationType.OTHERNOTIFICATION.name(), OtherNotification.class);
-+ return myMap;
-+ }
-+ }
-+
- public JSON setDateFormat(DateFormat dateFormat) {
- dateTypeAdapter.setFormat(dateFormat);
- return this;
-diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java
---- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java 2018-02-19 17:32:33.000000000 +0100
-+++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OTHERVIMINFO.java 2018-02-19 17:34:43.000000000 +0100
-@@ -43,13 +43,13 @@
- return false;
- }
- OTHERVIMINFO OTHER_VIM_INFO = (OTHERVIMINFO) o;
-- return &&
-+ return
- super.equals(o);
- }
-
- @Override
- public int hashCode() {
-- return Objects.hash(, super.hashCode());
-+ return Objects.hash( super.hashCode());
- }
-
-
-diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java
---- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java 2018-02-19 17:32:33.000000000 +0100
-+++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/OtherNotification.java 2018-02-19 17:34:43.000000000 +0100
-@@ -45,13 +45,13 @@
- return false;
- }
- OtherNotification otherNotification = (OtherNotification) o;
-- return &&
-+ return
- super.equals(o);
- }
-
- @Override
- public int hashCode() {
-- return Objects.hash(, super.hashCode());
-+ return Objects.hash( super.hashCode());
- }
-
-
-diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java
---- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java 2018-02-19 17:32:33.000000000 +0100
-+++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierCreationNotification.java 2018-02-19 17:34:43.000000000 +0100
-@@ -45,13 +45,13 @@
- return false;
- }
- VnfIdentifierCreationNotification vnfIdentifierCreationNotification = (VnfIdentifierCreationNotification) o;
-- return &&
-+ return
- super.equals(o);
- }
-
- @Override
- public int hashCode() {
-- return Objects.hash(, super.hashCode());
-+ return Objects.hash(super.hashCode());
- }
-
-
-diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java
---- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java 2018-02-19 17:32:33.000000000 +0100
-+++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfIdentifierDeletionNotification.java 2018-02-19 17:34:43.000000000 +0100
-@@ -45,13 +45,13 @@
- return false;
- }
- VnfIdentifierDeletionNotification vnfIdentifierDeletionNotification = (VnfIdentifierDeletionNotification) o;
-- return &&
-+ return
- super.equals(o);
- }
-
- @Override
- public int hashCode() {
-- return Objects.hash(, super.hashCode());
-+ return Objects.hash( super.hashCode());
- }
-
-
diff -Naur old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java
--- old/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java 2018-02-19 17:32:33.000000000 +0100
+++ new/cbam/src/gen/java/main/com/nokia/cbam/lcm/v32/model/VnfProperty.java 2018-02-19 17:38:08.000000000 +0100
diff --git a/nokiav2/generatortools/pom.xml b/nokiav2/generatortools/pom.xml
deleted file mode 100644
index 48f29234..00000000
--- a/nokiav2/generatortools/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright 2017 Nokia Corporation.
-
- 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.
--->
-<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">
- <parent>
- <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
- <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
- <artifactId>generatortools</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <name>vfc/nfvo/driver/vnfm/svnfm/nokiav2/generatortools</name>
- <dependencies>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-codegen</artifactId>
- <version>2.2.3</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/nokiav2/generatortools/src/main/java/com/nokia/cbam/swagger/CbamJavaClientCodegen.java b/nokiav2/generatortools/src/main/java/com/nokia/cbam/swagger/CbamJavaClientCodegen.java
deleted file mode 100644
index 8f82689c..00000000
--- a/nokiav2/generatortools/src/main/java/com/nokia/cbam/swagger/CbamJavaClientCodegen.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-* Copyright 2016-2017 Nokia Corporation
-*
-* 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.
-*/
-
-package com.nokia.cbam.swagger;
-
-import com.google.common.collect.Sets;
-import io.swagger.codegen.*;
-import io.swagger.models.Model;
-import io.swagger.models.ModelImpl;
-
-import java.io.File;
-import java.util.*;
-import io.swagger.codegen.languages.JavaClientCodegen;
-
-import static com.google.common.collect.Sets.newHashSet;
-
-public class CbamJavaClientCodegen extends JavaClientCodegen {
- public CbamJavaClientCodegen() {
- supportsInheritance = false;
- for (CliOption cliOption : this.cliOptions) {
- if(cliOption.getType().equals("useRxJava")){
- cliOption.setDefault("true");
- }
- System.err.println(cliOption.getOpt() + cliOption.getDefault());
- }
-
- }
-
- @Override
- public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) {
- CodegenModel m = super.fromModel(name, model, allDefinitions);
- //remove the fields inherited from parent objects
- remove(m, newHashSet("OPENSTACK_V3_INFO", "OPENSTACK_V2_INFO", "OTHER_VIM_INFO", "VMWARE_VCLOUD_INFO"), newHashSet("id"));
- remove(m, newHashSet("OtherNotification", "VnfIdentifierCreationNotification", "VnfIdentifierDeletionNotification", "VnfInfoAttributeValueChangeNotification", "VnfLifecycleChangeNotification"), newHashSet("notificationType", "subscriptionId", "timestamp", "vnfInstanceId"));
-
- if(model instanceof ModelImpl && (!m.isEnum) && !m.hasVars) {
- typeMapping.put(m.classname, typeMapping.get(((ModelImpl)model).getType()));
- }
- return m;
- }
-
- public void remove(CodegenModel m, Set<String> classNames, Set<String> fieldNames){
- System.err.println("**** Processing " + m.name);
- if(classNames.contains(m.name)){
- System.err.println("**** Processing " + m.name);
- Iterator<CodegenProperty> iterator = m.vars.iterator();
- while(iterator.hasNext()){
- CodegenProperty prop = iterator.next();
- if(fieldNames.contains(prop.name)){
- System.err.println("**** Removing: " + prop.name + " from " + m.name);
- iterator.remove();
- }
- System.err.println("********* Keeping " + prop.name + " from " + m.name);
- }
- }
- }
-
- @Override
- public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
- Map<String, Object> m = super.postProcessAllModels(objs);
- for(Map.Entry<String, Object> entry: m.entrySet()) {
- CodegenModel cm = ((HashMap<String, CodegenModel>)((List)((HashMap)entry.getValue()).get("models")).get(0)).get("model");
- for (CodegenProperty var : cm.vars) {
- if (typeMapping.containsKey(var.datatype)) {
- var.dataFormat = var.datatypeWithEnum = typeMapping.get(var.datatype);
- }
- }
- }
- return m;
- }
-
-}
diff --git a/nokiav2/pom.xml b/nokiav2/pom.xml
index 0dde00ac..e7a20eb1 100644
--- a/nokiav2/pom.xml
+++ b/nokiav2/pom.xml
@@ -28,7 +28,6 @@
<packaging>pom</packaging>
<name>vfc/nfvo/driver/vnfm/svnfm/nokiav2</name>
<modules>
- <module>generatortools</module>
<module>generatedapis</module>
<module>driver</module>
<module>driverwar</module>