Commit c92779d6 authored by Eduardo Santos's avatar Eduardo Santos
Browse files

Created PrimitivesParser + added primitives as a Service Specification...

Created PrimitivesParser + added primitives as a  Service Specification Characteristic + added tests for specFromNSDID()
parent aa6926dc
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -75,11 +75,13 @@ import org.etsi.osl.tmf.stm653.model.ServiceTestSpecificationUpdate;
import org.etsi.osl.tmf.stm653.reposervices.ServiceTestSpecificationRepoService;
import org.etsi.osl.tmf.util.AttachmentUtil;
import org.etsi.osl.tmf.util.KrokiClient;
import org.etsi.osl.tmf.util.PrimitivesParser;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.transform.ResultTransformer;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
@@ -1209,6 +1211,26 @@ public class ServiceSpecificationRepoService {
				logger.error("nsdid getConstituentVxF null returned: " + nsd.toString() );
			}

			/******************** Begin Primitives Handling ********************/

            // Access the first element only, to handle the case where there are duplicate descriptor fields
            ConstituentVxF vxf = nsd.getConstituentVxF().get(0);
        
            JSONObject nsdJson = PrimitivesParser.processNSD(nsd);
            JSONObject vnfdJson = PrimitivesParser.processVxF(vxf);
    
            JSONObject vnfs = PrimitivesParser.extractVNFIds(nsdJson);
            
            vnfs = PrimitivesParser.mapVDUsToVNFs(vnfdJson, vnfs);
    
            JSONObject vduPrimitives = PrimitivesParser.extractVDUPrimitives(vnfdJson, vnfs);
    
            JSONObject allPrimitives = PrimitivesParser.extractVNFPrimitives(vnfdJson, vduPrimitives);
    
            addServiceSpecCharacteristic(serviceSpec, "Primitives", "NSPrimitives", new Any(allPrimitives.toString(), ""), EValueType.TEXT);

            /********************* End Primitives Handling *********************/
			
			
			ResourceSpecificationRef resourceSpecificationItemRef = new ResourceSpecificationRef();
			resourceSpecificationItemRef.setId( resourceNSD.getId() );
+539 −0

File added.

Preview size limit exceeded, changes collapsed.

+509 −0

File added.

Preview size limit exceeded, changes collapsed.

+1172 −0

File added.

Preview size limit exceeded, changes collapsed.

+154 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading