Loading src/main/java/org/etsi/osl/tmf/scm633/reposervices/ServiceSpecificationRepoService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1144,7 +1144,7 @@ public class ServiceSpecificationRepoService { return null; } logger.error("nsdid returned: " + nsd.getName()); logger.debug("nsdid returned: " + nsd.getName()); List<ServiceSpecification> newRfservices = new ArrayList<>(); Loading src/main/java/org/etsi/osl/tmf/util/PrimitivesParser.java +23 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import org.yaml.snakeyaml.Yaml; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; Loading Loading @@ -107,10 +108,20 @@ public class PrimitivesParser { public static JSONObject processNSD(NetworkServiceDescriptor nsd) { // Parse the NSD descriptor from string to YAML Yaml yaml = new Yaml(); Map<String, Object> yamlMap = yaml.load(nsd.getDescriptor()); JSONObject nsdJson; Object obj = yaml.load(nsd.getDescriptor()); if ( obj instanceof ArrayList) { // Parse the NSD descriptor from YAML to JSONObject nsdJson = new JSONObject( (ArrayList<Object>)obj ); }else { Map<String, Object> yamlMap = ( Map<String, Object> ) obj; // Parse the NSD descriptor from YAML to JSONObject JSONObject nsdJson = new JSONObject(yamlMap); nsdJson = new JSONObject(yamlMap); } return nsdJson; } Loading Loading @@ -164,8 +175,14 @@ public class PrimitivesParser { // Attach the empty array to the JSONObject under the key "vnfs" vnfs.put("vnfs", vnfsArray); JSONArray nsdArray = null; if ( nsdJson.has("nsd") ) { nsdArray = nsdJson.getJSONObject("nsd").getJSONArray("nsd"); } else { nsdArray = new JSONArray(); nsdArray.put(nsdJson); } JSONArray nsdArray = nsdJson.getJSONObject("nsd").getJSONArray("nsd"); // Assuming that there might be multiple 'nsd' entries, iterate over them processNSDEntries(nsdArray, vnfsArray); Loading Loading
src/main/java/org/etsi/osl/tmf/scm633/reposervices/ServiceSpecificationRepoService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1144,7 +1144,7 @@ public class ServiceSpecificationRepoService { return null; } logger.error("nsdid returned: " + nsd.getName()); logger.debug("nsdid returned: " + nsd.getName()); List<ServiceSpecification> newRfservices = new ArrayList<>(); Loading
src/main/java/org/etsi/osl/tmf/util/PrimitivesParser.java +23 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import org.yaml.snakeyaml.Yaml; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; Loading Loading @@ -107,10 +108,20 @@ public class PrimitivesParser { public static JSONObject processNSD(NetworkServiceDescriptor nsd) { // Parse the NSD descriptor from string to YAML Yaml yaml = new Yaml(); Map<String, Object> yamlMap = yaml.load(nsd.getDescriptor()); JSONObject nsdJson; Object obj = yaml.load(nsd.getDescriptor()); if ( obj instanceof ArrayList) { // Parse the NSD descriptor from YAML to JSONObject nsdJson = new JSONObject( (ArrayList<Object>)obj ); }else { Map<String, Object> yamlMap = ( Map<String, Object> ) obj; // Parse the NSD descriptor from YAML to JSONObject JSONObject nsdJson = new JSONObject(yamlMap); nsdJson = new JSONObject(yamlMap); } return nsdJson; } Loading Loading @@ -164,8 +175,14 @@ public class PrimitivesParser { // Attach the empty array to the JSONObject under the key "vnfs" vnfs.put("vnfs", vnfsArray); JSONArray nsdArray = null; if ( nsdJson.has("nsd") ) { nsdArray = nsdJson.getJSONObject("nsd").getJSONArray("nsd"); } else { nsdArray = new JSONArray(); nsdArray.put(nsdJson); } JSONArray nsdArray = nsdJson.getJSONObject("nsd").getJSONArray("nsd"); // Assuming that there might be multiple 'nsd' entries, iterate over them processNSDEntries(nsdArray, vnfsArray); Loading