Loading src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java +2 −2 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public class LCMRulesExecutor { ApplicationHome home = new ApplicationHome(LCMRulesExecutor.class); File classesJar = home.getSource(); if ( classesJar.exists() ) { if ( classesJar != null && classesJar.exists() ) { optionList.addAll(Arrays.asList("-classpath", classesJar.getAbsoluteFile().toString().replace("-exec", "") )); } logger.debug("classesJar = "+ classesJar); Loading Loading @@ -213,7 +213,7 @@ public class LCMRulesExecutor { URL[] classpath = new URL[] { temp.toUri().toURL() }; if ( classesJar.exists() ) { if ( classesJar != null && classesJar.exists() ) { classpath = new URL[] { temp.toUri().toURL(), classesJar.toURI().toURL() }; } logger.debug("classpath = "+ classpath.toString()); Loading src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutorVariables.java +3 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ public class LCMRulesExecutorVariables { private Service service; private List<String> compileDiagnosticErrors; private ServiceOrderManager serviceOrderManager; private Map<String, String> outParams; private Map<String, Map<String, String> > outParams; /** * @param spec Loading @@ -50,6 +50,7 @@ public class LCMRulesExecutorVariables { this.service = serviceInstance; this.serviceOrderManager = aServiceOrderManager; this.compileDiagnosticErrors = new ArrayList<>(); this.outParams = new HashMap<String,String>(); this.outParams = new HashMap<>(); } } src/main/java/org/etsi/osl/osom/lcm/LcmBaseExecutor.java +154 −5 Original line number Diff line number Diff line package org.etsi.osl.osom.lcm; 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.Optional; import java.util.function.Consumer; Loading @@ -27,6 +30,8 @@ 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.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.ServiceOrderItemRelationship; Loading Loading @@ -391,8 +396,10 @@ public abstract class LcmBaseExecutor { System.out.println("============================================================================= \n"); System.out.println("The value length is apayload= \n" + apayload.length()); System.out.println("The value is apayload= \n" + apayload); if (apayload!=null) { System.out.println("The value length is apayload= \n" + apayload.length()); } System.out.println("============================================================================= \n"); if (baseurl != null) { Loading Loading @@ -791,8 +798,149 @@ public abstract class LcmBaseExecutor { /** * Set the value to a characteristics of a referenced service * @param serviceName the name of the service reference * @param characteristics map with name.value * @param value */ public void setServiceRefCharacteristicsValues(String serviceName, HashMap<String, String> charvals) { //logger.debug( String.format( "setServiceRefPropValue %s %s %s ", serviceName, characteristicName, value ) ); logger.debug( String.format( "setServiceRefCharacteristicsValues for %s ", serviceName ) ); Service ctxService = this.vars.getService(); if (ctxService == null) { ServiceCreate scre = this.vars.getServiceToCreate(); if (scre != null) { for (String charname : charvals.keySet()) { setCharacteristicOfCurrentService( serviceName + "::" + charname, charvals.get(charname) ); } } return; } @NotNull @Valid ServiceRef refSrvice = null; for (ServiceRef sr : ctxService.getSupportingService()) { if ( sr.getName().equals(serviceName) ) { refSrvice = sr; break; } } if (refSrvice == null) { return; } if (this.vars.getServiceOrderManager() != null) { Service aService = this.vars.getServiceOrderManager().retrieveService(refSrvice.getId()); if (aService != null) { ServiceUpdate supd = new ServiceUpdate(); Note n = new Note(); n.setAuthor("LCMRULE " + this.lcmspec.getName()); n.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); String note = ""; for (String charname : charvals.keySet()) { setCharacteristicOfCurrentService( serviceName + "::" + charname, charvals.get(charname) ); Characteristic servicecrspecLast = aService.getServiceCharacteristicByName(charname); if (servicecrspecLast != null) { servicecrspecLast.getValue().setValue( charvals.get(charname) ); supd.addServiceCharacteristicItem(servicecrspecLast); note += charname + "=" + charvals.get(charname)+ ", "; } } n.setText( String.format( "New characterisictic values for ServiceRef %s: %s" , serviceName, note )); supd.addNoteItem(n); this.vars.getServiceOrderManager().updateService(aService.getId(), supd, true); } } } // /** // * Set the value to a characteristic of a referenced service // * @param serviceName the name of the service reference // * @param characteristicName // * @param value // */ // public void setServiceRefPropValue( String serviceName, String characteristicName, String value ) { // logger.debug( String.format( "setServiceRefPropValue %s %s %s ", serviceName, characteristicName, value ) ); // Service ctxService = this.vars.getService(); // // // if (ctxService == null) { // ServiceCreate scre = this.vars.getServiceToCreate(); // if (scre != null) { // setCharacteristicOfCurrentService( serviceName + "::" + characteristicName, value); // } // return; // } // // // // // // // @NotNull @Valid ServiceRef refSrvice = null; // // for (ServiceRef sr : ctxService.getSupportingService()) { // if ( sr.getName().equals(serviceName) ) { // refSrvice = sr; // break; // } // } // // // setCharacteristicOfCurrentService( serviceName + "::" + characteristicName, value); // // if (refSrvice == null) { // return; // } // // if (this.vars.getServiceOrderManager() != null) { // Service aService = this.vars.getServiceOrderManager().retrieveService(refSrvice.getId()); // if (aService != null) { // // ServiceUpdate supd = new ServiceUpdate(); // // Characteristic servicecrspecLast = // aService.getServiceCharacteristicByName(characteristicName); // if (servicecrspecLast != null) { // servicecrspecLast.getValue().setValue(value); // supd.addServiceCharacteristicItem(servicecrspecLast); // Note n = new Note(); // n.setAuthor("LCMRULE " + this.lcmspec.getName()); // n.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); // n.setText("Set new value (" + value + ") to ref Service (" + serviceName // + ") Characteristic: " + characteristicName); // supd.addNoteItem(n); // this.vars.getServiceOrderManager().updateService(aService.getId(), supd, true); // // // } // // } // // } // // } //createServiceRefIf("Bundle B", getServiceRefPropValue("BundleA", "state", "").equals("active")==true); public boolean createServiceRefIf(String serviceName, boolean b) { public boolean createServiceRefIf(String serviceName, boolean b, HashMap<String, String> charvals) { logger.debug( String.format("createServiceRefwhen serviceName=%s = %s", serviceName, b ) ); Loading @@ -806,7 +954,8 @@ public abstract class LcmBaseExecutor { if (serviceIDToCheckDependcy != null) { this.vars.getOutParams().put( serviceIDToCheckDependcy, Boolean.toString(b) ); charvals.put("_CREATESERVICEREF_", Boolean.toString(b)); this.vars.getOutParams().put( serviceIDToCheckDependcy, charvals ); } return false; Loading src/main/java/org/etsi/osl/osom/management/CreateReservedService.java +50 −18 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ package org.etsi.osl.osom.management; 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 org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.etsi.osl.osom.lcm.LCMRulesController; Loading Loading @@ -96,9 +98,16 @@ public class CreateReservedService implements JavaDelegate { logger.debug("Retrieved Service ID:" + spec.getId()); logger.debug("Retrieved Service Name:" + spec.getName()); //this map contains as key the id of the serviceSpecs to be created //and as value a Map of initial characteristics and their values Map<String, Map<String,String>> tobeCreatedInitialCharValues = new HashMap<>(); if ( execution.getVariable("serviceSpecsToCreateInitialCharValues") != null ) { tobeCreatedInitialCharValues = (Map<String, Map<String, String>>) execution.getVariable("serviceSpecsToCreateInitialCharValues"); } //this is a main underlying service for the requested service (restriction) Service createdUnderlService = addServicesToVariables( spec, sor, soi, parentService ); Service createdUnderlService = addServicesToVariables( spec, sor, soi, parentService, tobeCreatedInitialCharValues ); soi.getService().setState( ServiceStateType.RESERVED ); soi.setState(ServiceOrderStateType.INPROGRESS); Loading Loading @@ -145,11 +154,12 @@ public class CreateReservedService implements JavaDelegate { * @param servicesHandledByNFVOAutomated * @param servicesLocallyAutomated * @param parentService * @param tobeCreatedInitialCharValues * @return */ private Service addServicesToVariables(ServiceSpecification specrel, ServiceOrder sor, ServiceOrderItem soi, Service parentService) { Service parentService, Map<String, Map<String, String>> tobeCreatedInitialCharValues) { logger.debug("\tService spec name :" + specrel.getName()); logger.debug("\tService spec type :" + specrel.getType()); Loading @@ -159,25 +169,23 @@ public class CreateReservedService implements JavaDelegate { if ( partnerOrg != null ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, partnerOrg, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, partnerOrg, parentService, tobeCreatedInitialCharValues); } else if (specrel.getType().equals("ResourceFacingServiceSpecification")) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.isIsBundle()!=null) && specrel.isIsBundle() ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.findSpecCharacteristicByName("OSAUTOMATED") != null ) ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.findSpecCharacteristicByName("testSpecRef") != null ) ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.MANUALLY_BY_SERVICE_PROVIDER, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.MANUALLY_BY_SERVICE_PROVIDER, null, parentService, tobeCreatedInitialCharValues); } //add now the serviceRef Loading Loading @@ -233,11 +241,15 @@ public class CreateReservedService implements JavaDelegate { * @param sor * @param soi * @param spec * @param startMode * @param partnerOrg * @param parentService * @param tobeCreatedInitialCharValues * @return */ private Service createServiceByServiceSpec(ServiceOrder sor, ServiceOrderItem soi, ServiceSpecification spec, EServiceStartMode startMode, RelatedParty partnerOrg, Service parentService) { RelatedParty partnerOrg, Service parentService, Map<String, Map<String, String>> tobeCreatedInitialCharValues) { ServiceCreate serviceToCreate = new ServiceCreate(); String servicename = spec.getName(); Loading Loading @@ -284,15 +296,33 @@ public class CreateReservedService implements JavaDelegate { } } //this map contains as key the id of the serviceSpecs to be created //and as value a Map of initial characteristics and their values Map<String, String> initCharValues = tobeCreatedInitialCharValues.get( spec.getId() ); //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; //pass any initial value. This has high priority if ( initCharValues != null ) { if ( initCharValues.get( c.getName() ) != null ) { Characteristic orderCharacteristic = new Characteristic() .value( new Any( initCharValues.get( c.getName() ), initCharValues.get( c.getName() ))) ; serviceToCreate.addServiceCharacteristicItem( helperCreateCharacteristicItem(c, orderCharacteristic ) ); characteristicFound = true; continue; } } 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) ); serviceToCreate.addServiceCharacteristicItem( helperCreateCharacteristicItem(c, orderCharacteristic) ); characteristicFound = true; break; } Loading @@ -303,7 +333,7 @@ public class CreateReservedService implements JavaDelegate { String specCharacteristicToSearch = c.getName(); if ( orderCharacteristic.getName().equals( specCharacteristicToSearch )) { //copy only characteristics that are related from the order serviceToCreate.addServiceCharacteristicItem( addServiceCharacteristicItem(c, orderCharacteristic) ); serviceToCreate.addServiceCharacteristicItem( helperCreateCharacteristicItem(c, orderCharacteristic) ); characteristicFound = true; break; } Loading @@ -311,6 +341,8 @@ public class CreateReservedService implements JavaDelegate { } } if ( serviceToCreate.getServiceCharacteristic() == null ) { Loading Loading @@ -385,7 +417,7 @@ public class CreateReservedService implements JavaDelegate { return null; } private Characteristic addServiceCharacteristicItem(ServiceSpecCharacteristic c, Characteristic orderCharacteristic) { private Characteristic helperCreateCharacteristicItem(ServiceSpecCharacteristic c, Characteristic orderCharacteristic) { Characteristic serviceCharacteristicItem = new Characteristic(); serviceCharacteristicItem.setName( c.getName() ); serviceCharacteristicItem.setValueType( c.getValueType() ); Loading src/main/java/org/etsi/osl/osom/management/NFVOrchestrationCheckDeploymentService.java +5 −5 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public class NFVOrchestrationCheckDeploymentService implements JavaDelegate { ServiceUpdate supd = new ServiceUpdate(); boolean aVNFINDEXREFadded = false; boolean propagateToSO = false; boolean triggerServiceActionQueue = false; if ( aService.getServiceCharacteristic() != null ) { for (Characteristic c : aService.getServiceCharacteristic()) { Loading @@ -103,17 +103,17 @@ public class NFVOrchestrationCheckDeploymentService implements JavaDelegate { c.setValue( new Any( dd.getInstanceId() + "" )); } else if ( c.getName().equals("NSR")) { c.setValue( new Any( dd.getNsr() + "" )); propagateToSO = true; triggerServiceActionQueue = true; } else if ( c.getName().equals("NSLCM")) { c.setValue( new Any( dd.getNs_nslcm_details() + "" )); propagateToSO = true; triggerServiceActionQueue = 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; triggerServiceActionQueue = true; } } Loading Loading @@ -153,7 +153,7 @@ public class NFVOrchestrationCheckDeploymentService implements JavaDelegate { supd.setState( ServiceStateType.TERMINATED ); } Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, propagateToSO ); Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, triggerServiceActionQueue ); if ( serviceResult!= null ) { if ( serviceResult.getState().equals(ServiceStateType.ACTIVE) Loading Loading
src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java +2 −2 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ public class LCMRulesExecutor { ApplicationHome home = new ApplicationHome(LCMRulesExecutor.class); File classesJar = home.getSource(); if ( classesJar.exists() ) { if ( classesJar != null && classesJar.exists() ) { optionList.addAll(Arrays.asList("-classpath", classesJar.getAbsoluteFile().toString().replace("-exec", "") )); } logger.debug("classesJar = "+ classesJar); Loading Loading @@ -213,7 +213,7 @@ public class LCMRulesExecutor { URL[] classpath = new URL[] { temp.toUri().toURL() }; if ( classesJar.exists() ) { if ( classesJar != null && classesJar.exists() ) { classpath = new URL[] { temp.toUri().toURL(), classesJar.toURI().toURL() }; } logger.debug("classpath = "+ classpath.toString()); Loading
src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutorVariables.java +3 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ public class LCMRulesExecutorVariables { private Service service; private List<String> compileDiagnosticErrors; private ServiceOrderManager serviceOrderManager; private Map<String, String> outParams; private Map<String, Map<String, String> > outParams; /** * @param spec Loading @@ -50,6 +50,7 @@ public class LCMRulesExecutorVariables { this.service = serviceInstance; this.serviceOrderManager = aServiceOrderManager; this.compileDiagnosticErrors = new ArrayList<>(); this.outParams = new HashMap<String,String>(); this.outParams = new HashMap<>(); } }
src/main/java/org/etsi/osl/osom/lcm/LcmBaseExecutor.java +154 −5 Original line number Diff line number Diff line package org.etsi.osl.osom.lcm; 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.Optional; import java.util.function.Consumer; Loading @@ -27,6 +30,8 @@ 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.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.ServiceOrderItemRelationship; Loading Loading @@ -391,8 +396,10 @@ public abstract class LcmBaseExecutor { System.out.println("============================================================================= \n"); System.out.println("The value length is apayload= \n" + apayload.length()); System.out.println("The value is apayload= \n" + apayload); if (apayload!=null) { System.out.println("The value length is apayload= \n" + apayload.length()); } System.out.println("============================================================================= \n"); if (baseurl != null) { Loading Loading @@ -791,8 +798,149 @@ public abstract class LcmBaseExecutor { /** * Set the value to a characteristics of a referenced service * @param serviceName the name of the service reference * @param characteristics map with name.value * @param value */ public void setServiceRefCharacteristicsValues(String serviceName, HashMap<String, String> charvals) { //logger.debug( String.format( "setServiceRefPropValue %s %s %s ", serviceName, characteristicName, value ) ); logger.debug( String.format( "setServiceRefCharacteristicsValues for %s ", serviceName ) ); Service ctxService = this.vars.getService(); if (ctxService == null) { ServiceCreate scre = this.vars.getServiceToCreate(); if (scre != null) { for (String charname : charvals.keySet()) { setCharacteristicOfCurrentService( serviceName + "::" + charname, charvals.get(charname) ); } } return; } @NotNull @Valid ServiceRef refSrvice = null; for (ServiceRef sr : ctxService.getSupportingService()) { if ( sr.getName().equals(serviceName) ) { refSrvice = sr; break; } } if (refSrvice == null) { return; } if (this.vars.getServiceOrderManager() != null) { Service aService = this.vars.getServiceOrderManager().retrieveService(refSrvice.getId()); if (aService != null) { ServiceUpdate supd = new ServiceUpdate(); Note n = new Note(); n.setAuthor("LCMRULE " + this.lcmspec.getName()); n.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); String note = ""; for (String charname : charvals.keySet()) { setCharacteristicOfCurrentService( serviceName + "::" + charname, charvals.get(charname) ); Characteristic servicecrspecLast = aService.getServiceCharacteristicByName(charname); if (servicecrspecLast != null) { servicecrspecLast.getValue().setValue( charvals.get(charname) ); supd.addServiceCharacteristicItem(servicecrspecLast); note += charname + "=" + charvals.get(charname)+ ", "; } } n.setText( String.format( "New characterisictic values for ServiceRef %s: %s" , serviceName, note )); supd.addNoteItem(n); this.vars.getServiceOrderManager().updateService(aService.getId(), supd, true); } } } // /** // * Set the value to a characteristic of a referenced service // * @param serviceName the name of the service reference // * @param characteristicName // * @param value // */ // public void setServiceRefPropValue( String serviceName, String characteristicName, String value ) { // logger.debug( String.format( "setServiceRefPropValue %s %s %s ", serviceName, characteristicName, value ) ); // Service ctxService = this.vars.getService(); // // // if (ctxService == null) { // ServiceCreate scre = this.vars.getServiceToCreate(); // if (scre != null) { // setCharacteristicOfCurrentService( serviceName + "::" + characteristicName, value); // } // return; // } // // // // // // // @NotNull @Valid ServiceRef refSrvice = null; // // for (ServiceRef sr : ctxService.getSupportingService()) { // if ( sr.getName().equals(serviceName) ) { // refSrvice = sr; // break; // } // } // // // setCharacteristicOfCurrentService( serviceName + "::" + characteristicName, value); // // if (refSrvice == null) { // return; // } // // if (this.vars.getServiceOrderManager() != null) { // Service aService = this.vars.getServiceOrderManager().retrieveService(refSrvice.getId()); // if (aService != null) { // // ServiceUpdate supd = new ServiceUpdate(); // // Characteristic servicecrspecLast = // aService.getServiceCharacteristicByName(characteristicName); // if (servicecrspecLast != null) { // servicecrspecLast.getValue().setValue(value); // supd.addServiceCharacteristicItem(servicecrspecLast); // Note n = new Note(); // n.setAuthor("LCMRULE " + this.lcmspec.getName()); // n.setDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); // n.setText("Set new value (" + value + ") to ref Service (" + serviceName // + ") Characteristic: " + characteristicName); // supd.addNoteItem(n); // this.vars.getServiceOrderManager().updateService(aService.getId(), supd, true); // // // } // // } // // } // // } //createServiceRefIf("Bundle B", getServiceRefPropValue("BundleA", "state", "").equals("active")==true); public boolean createServiceRefIf(String serviceName, boolean b) { public boolean createServiceRefIf(String serviceName, boolean b, HashMap<String, String> charvals) { logger.debug( String.format("createServiceRefwhen serviceName=%s = %s", serviceName, b ) ); Loading @@ -806,7 +954,8 @@ public abstract class LcmBaseExecutor { if (serviceIDToCheckDependcy != null) { this.vars.getOutParams().put( serviceIDToCheckDependcy, Boolean.toString(b) ); charvals.put("_CREATESERVICEREF_", Boolean.toString(b)); this.vars.getOutParams().put( serviceIDToCheckDependcy, charvals ); } return false; Loading
src/main/java/org/etsi/osl/osom/management/CreateReservedService.java +50 −18 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ package org.etsi.osl.osom.management; 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 org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.etsi.osl.osom.lcm.LCMRulesController; Loading Loading @@ -96,9 +98,16 @@ public class CreateReservedService implements JavaDelegate { logger.debug("Retrieved Service ID:" + spec.getId()); logger.debug("Retrieved Service Name:" + spec.getName()); //this map contains as key the id of the serviceSpecs to be created //and as value a Map of initial characteristics and their values Map<String, Map<String,String>> tobeCreatedInitialCharValues = new HashMap<>(); if ( execution.getVariable("serviceSpecsToCreateInitialCharValues") != null ) { tobeCreatedInitialCharValues = (Map<String, Map<String, String>>) execution.getVariable("serviceSpecsToCreateInitialCharValues"); } //this is a main underlying service for the requested service (restriction) Service createdUnderlService = addServicesToVariables( spec, sor, soi, parentService ); Service createdUnderlService = addServicesToVariables( spec, sor, soi, parentService, tobeCreatedInitialCharValues ); soi.getService().setState( ServiceStateType.RESERVED ); soi.setState(ServiceOrderStateType.INPROGRESS); Loading Loading @@ -145,11 +154,12 @@ public class CreateReservedService implements JavaDelegate { * @param servicesHandledByNFVOAutomated * @param servicesLocallyAutomated * @param parentService * @param tobeCreatedInitialCharValues * @return */ private Service addServicesToVariables(ServiceSpecification specrel, ServiceOrder sor, ServiceOrderItem soi, Service parentService) { Service parentService, Map<String, Map<String, String>> tobeCreatedInitialCharValues) { logger.debug("\tService spec name :" + specrel.getName()); logger.debug("\tService spec type :" + specrel.getType()); Loading @@ -159,25 +169,23 @@ public class CreateReservedService implements JavaDelegate { if ( partnerOrg != null ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, partnerOrg, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, partnerOrg, parentService, tobeCreatedInitialCharValues); } else if (specrel.getType().equals("ResourceFacingServiceSpecification")) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.isIsBundle()!=null) && specrel.isIsBundle() ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.findSpecCharacteristicByName("OSAUTOMATED") != null ) ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else if ( specrel.getType().equals("CustomerFacingServiceSpecification") && (specrel.findSpecCharacteristicByName("testSpecRef") != null ) ) { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.AUTOMATICALLY_MANAGED, null, parentService, tobeCreatedInitialCharValues); } else { createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.MANUALLY_BY_SERVICE_PROVIDER, null, parentService); createdServ = createServiceByServiceSpec(sor, soi, specrel, EServiceStartMode.MANUALLY_BY_SERVICE_PROVIDER, null, parentService, tobeCreatedInitialCharValues); } //add now the serviceRef Loading Loading @@ -233,11 +241,15 @@ public class CreateReservedService implements JavaDelegate { * @param sor * @param soi * @param spec * @param startMode * @param partnerOrg * @param parentService * @param tobeCreatedInitialCharValues * @return */ private Service createServiceByServiceSpec(ServiceOrder sor, ServiceOrderItem soi, ServiceSpecification spec, EServiceStartMode startMode, RelatedParty partnerOrg, Service parentService) { RelatedParty partnerOrg, Service parentService, Map<String, Map<String, String>> tobeCreatedInitialCharValues) { ServiceCreate serviceToCreate = new ServiceCreate(); String servicename = spec.getName(); Loading Loading @@ -284,15 +296,33 @@ public class CreateReservedService implements JavaDelegate { } } //this map contains as key the id of the serviceSpecs to be created //and as value a Map of initial characteristics and their values Map<String, String> initCharValues = tobeCreatedInitialCharValues.get( spec.getId() ); //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; //pass any initial value. This has high priority if ( initCharValues != null ) { if ( initCharValues.get( c.getName() ) != null ) { Characteristic orderCharacteristic = new Characteristic() .value( new Any( initCharValues.get( c.getName() ), initCharValues.get( c.getName() ))) ; serviceToCreate.addServiceCharacteristicItem( helperCreateCharacteristicItem(c, orderCharacteristic ) ); characteristicFound = true; continue; } } 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) ); serviceToCreate.addServiceCharacteristicItem( helperCreateCharacteristicItem(c, orderCharacteristic) ); characteristicFound = true; break; } Loading @@ -303,7 +333,7 @@ public class CreateReservedService implements JavaDelegate { String specCharacteristicToSearch = c.getName(); if ( orderCharacteristic.getName().equals( specCharacteristicToSearch )) { //copy only characteristics that are related from the order serviceToCreate.addServiceCharacteristicItem( addServiceCharacteristicItem(c, orderCharacteristic) ); serviceToCreate.addServiceCharacteristicItem( helperCreateCharacteristicItem(c, orderCharacteristic) ); characteristicFound = true; break; } Loading @@ -311,6 +341,8 @@ public class CreateReservedService implements JavaDelegate { } } if ( serviceToCreate.getServiceCharacteristic() == null ) { Loading Loading @@ -385,7 +417,7 @@ public class CreateReservedService implements JavaDelegate { return null; } private Characteristic addServiceCharacteristicItem(ServiceSpecCharacteristic c, Characteristic orderCharacteristic) { private Characteristic helperCreateCharacteristicItem(ServiceSpecCharacteristic c, Characteristic orderCharacteristic) { Characteristic serviceCharacteristicItem = new Characteristic(); serviceCharacteristicItem.setName( c.getName() ); serviceCharacteristicItem.setValueType( c.getValueType() ); Loading
src/main/java/org/etsi/osl/osom/management/NFVOrchestrationCheckDeploymentService.java +5 −5 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public class NFVOrchestrationCheckDeploymentService implements JavaDelegate { ServiceUpdate supd = new ServiceUpdate(); boolean aVNFINDEXREFadded = false; boolean propagateToSO = false; boolean triggerServiceActionQueue = false; if ( aService.getServiceCharacteristic() != null ) { for (Characteristic c : aService.getServiceCharacteristic()) { Loading @@ -103,17 +103,17 @@ public class NFVOrchestrationCheckDeploymentService implements JavaDelegate { c.setValue( new Any( dd.getInstanceId() + "" )); } else if ( c.getName().equals("NSR")) { c.setValue( new Any( dd.getNsr() + "" )); propagateToSO = true; triggerServiceActionQueue = true; } else if ( c.getName().equals("NSLCM")) { c.setValue( new Any( dd.getNs_nslcm_details() + "" )); propagateToSO = true; triggerServiceActionQueue = 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; triggerServiceActionQueue = true; } } Loading Loading @@ -153,7 +153,7 @@ public class NFVOrchestrationCheckDeploymentService implements JavaDelegate { supd.setState( ServiceStateType.TERMINATED ); } Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, propagateToSO ); Service serviceResult = serviceOrderManager.updateService( aService.getId(), supd, triggerServiceActionQueue ); if ( serviceResult!= null ) { if ( serviceResult.getState().equals(ServiceStateType.ACTIVE) Loading