Commits (17)
......@@ -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);
......@@ -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());
......
......@@ -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
......@@ -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<>();
}
}
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;
......@@ -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;
......@@ -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);
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) {
......@@ -788,11 +795,152 @@ public abstract class LcmBaseExecutor {
return "";
}
/**
* 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) {
//createServiceRefIf("Bundle B", getServiceRefPropValue("BundleA", "state", "").equals("active")==true);
public boolean createServiceRefIf(String serviceName, boolean b, HashMap<String, String> charvals) {
logger.debug( String.format("createServiceRefwhen serviceName=%s = %s", serviceName, b ) );
......@@ -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;
......
......@@ -95,7 +95,7 @@ public class CROrchestrationCheckDeploymentService implements JavaDelegate {
}
@Valid
ServiceStateType currentState = aService.getState();
ServiceStateType currentState = aService.getState();
ServiceStateType nextState = aService.findNextStateBasedOnSupportingResources(rlist);
......
......@@ -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;
......@@ -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);
......@@ -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());
......@@ -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
......@@ -228,16 +236,20 @@ public class CreateReservedService implements JavaDelegate {
}
/**
* @param sor
* @param soi
* @param soi
* @param spec
* @return
* @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();
......@@ -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;
}
......@@ -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;
}
......@@ -311,6 +341,8 @@ public class CreateReservedService implements JavaDelegate {
}
}
if ( serviceToCreate.getServiceCharacteristic() == null ) {
......@@ -329,7 +361,7 @@ public class CreateReservedService implements JavaDelegate {
}
}
}
//also add parent service as relationship to parent
ServiceRelationship srelationship = new ServiceRelationship();
......@@ -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() );
......
......@@ -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()) {
......@@ -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;
}
}
......@@ -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)
......
......@@ -48,6 +48,9 @@ public class ProcessCreateServiceRules implements JavaDelegate {
execution.setVariable("allSupportingServicesCreated", allSupportingServicesCreated ); //by default
Service contextService = null;
String contextServiceId = (String) execution.getVariable("contextServiceId");
if ( contextServiceId != null ) {
......@@ -69,29 +72,18 @@ public class ProcessCreateServiceRules implements JavaDelegate {
* first find all referenced ServiceSpecs of a ServiceSpec to be created
*/
boolean foundCreatedButNOTACTIVEServices = false;
Map<String, Boolean> tobeCreated = new HashMap<>();
//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>> tobeCreated = new HashMap<>();
for (ServiceSpecRelationship specRels : spec.getServiceSpecRelationship()) {
logger.debug("\tService specRelsId:" + specRels.getId());
tobeCreated.put(specRels.getId(), true);
tobeCreated.put(specRels.getId(), null);
}
for ( ServiceRef serviceRef: contextService.getSupportingService() ) {
Service theServiceReferenced = serviceOrderManager.retrieveService( serviceRef.getId() );
if ( tobeCreated.get(theServiceReferenced.getServiceSpecificationRef().getId() ) != null ) {
tobeCreated.put( theServiceReferenced.getServiceSpecificationRef().getId(), false);
}
if ( theServiceReferenced != null ) {
if ( theServiceReferenced.getState().equals( ServiceStateType.RESERVED) ) {
foundCreatedButNOTACTIVEServices = true;
}
}
}
/**
......@@ -123,20 +115,45 @@ public class ProcessCreateServiceRules implements JavaDelegate {
for (String serviceId : vars.getOutParams().keySet()) {
if ( vars.getOutParams().get(serviceId) !=null) {
if ( vars.getOutParams().get(serviceId).equals( "true") ) {
tobeCreated.put( serviceId, true && tobeCreated.get(serviceId) );
} else {
tobeCreated.put( serviceId, false);
allSupportingServicesCreated = false;
}
if ( vars.getOutParams().get(serviceId) != null && vars.getOutParams().get(serviceId).get("_CREATESERVICEREF_") !=null) {
if ( vars.getOutParams().get(serviceId).get("_CREATESERVICEREF_").equals( "true") ) {
vars.getOutParams().get(serviceId).remove( "_CREATESERVICEREF_" );
HashMap<String, String> myChars = new HashMap< String , String >( vars.getOutParams().get(serviceId) );
tobeCreated.put( serviceId, myChars );
} else {
tobeCreated.remove( serviceId);
allSupportingServicesCreated = false;
}
}
}
}
//now compare those to be created, with those already created
for ( ServiceRef serviceRef: contextService.getSupportingService() ) {
Service theServiceReferenced = serviceOrderManager.retrieveService( serviceRef.getId() );
if ( tobeCreated.containsKey(theServiceReferenced.getServiceSpecificationRef().getId() ) ) {
tobeCreated.remove( theServiceReferenced.getServiceSpecificationRef().getId());
}
if ( theServiceReferenced != null ) {
if ( theServiceReferenced.getState().equals( ServiceStateType.RESERVED) ) {
foundCreatedButNOTACTIVEServices = true;
}
}
}
serviceOrderManager.updateService( contextService.getId() , supd, false); //update context service
List<String> servicesToCreate = new ArrayList<>();
for (String specid : tobeCreated.keySet()) {
if ( tobeCreated.get(specid) ) {
if ( tobeCreated.containsKey(specid) ) {
servicesToCreate.add(specid);
allSupportingServicesCreated = false;
}
......@@ -161,11 +178,21 @@ public class ProcessCreateServiceRules implements JavaDelegate {
}
if ( contextService.getState().equals( ServiceStateType.INACTIVE ) || contextService.getState().equals( ServiceStateType.TERMINATED ) ) {
allSupportingServicesCreatedAndActive = true;
allSupportingServicesCreated = true;
// this will help us to avoid a deadlock if a failure occurs
}
execution.setVariable("allSupportingServicesCreated", allSupportingServicesCreated );
execution.setVariable("allSupportingServicesCreatedAndActive", allSupportingServicesCreatedAndActive && allSupportingServicesCreated ); //by default
execution.setVariable("parentServiceId", contextServiceId);
execution.setVariable("serviceSpecsToCreate", servicesToCreate);
execution.setVariable("serviceSpecsToCreate", servicesToCreate);
execution.setVariable("serviceSpecsToCreateInitialCharValues", tobeCreated);
}
......
......@@ -448,16 +448,16 @@ public class ServiceOrderManager {
/**
* @param serviceId
* @param s
* @param propagateToSO is a cryptic thing. However it is used as follows: if FALSE, to just update the service status in catalog without further taking any action.
* @param triggerServiceActionQueue is a cryptic thing. However it is used as follows: if FALSE, to just update the service status in catalog without further taking any action.
* if TRUE then the ServiceUpdate will trigger a ServiceActionQueue to further process the update. So this is needed to avoid these kinds of deadlocks
* @return
*/
public org.etsi.osl.tmf.sim638.model.Service updateService(String serviceId, ServiceUpdate s, boolean propagateToSO) {
public org.etsi.osl.tmf.sim638.model.Service updateService(String serviceId, ServiceUpdate s, boolean triggerServiceActionQueue) {
logger.info("will update Service : " + serviceId );
try {
Map<String, Object> map = new HashMap<>();
map.put("serviceid", serviceId );
map.put("propagateToSO", propagateToSO );
map.put("triggerServiceActionQueue", triggerServiceActionQueue );
Object response = template.requestBodyAndHeaders( CATALOG_UPD_SERVICE, toJsonString(s), map);
......
......@@ -79,7 +79,9 @@ public class ServiceActionCheck implements JavaDelegate {
execution.setVariable("saction", "HandleActiveStateChanged");
} else if ( item.getAction().equals( ServiceActionQueueAction.EVALUATE_STATE_CHANGE_TOINACTIVE ) ) {
execution.setVariable("saction", "HandleInactiveStateChanged");
} else if ( item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED ) || item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED_MANODAY2 ) ) {
} else if ( item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED )
|| item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHILD_CHARACTERISTIC_CHANGED )
|| item.getAction().equals( ServiceActionQueueAction.EVALUATE_CHARACTERISTIC_CHANGED_MANODAY2 ) ) {
execution.setVariable("saction", "HandleEvaluateService");// default
......
___ ____ _ _
/ _ \ _ __ ___ _ __ / ___|| (_) ___ ___
| | | | '_ \ / _ \ '_ \\___ \| | |/ __/ _ \
| |_| | |_) | __/ | | |___) | | | (_| __/
\___/| .__/ \___|_| |_|____/|_|_|\___\___|
|_|
__ __________________
/ / __ __ / __/_ __/ __/ _/
/ _ \/ // / / _/ / / _\ \_/ /
/_.__/\_, / /___/ /_/ /___/___/
/___/
\ No newline at end of file
......@@ -181,7 +181,7 @@ public class ProcessOrderIntegrationTest {
assertThat(spec).isInstanceOf(ServiceSpecification.class);
assertThat(spec.getServiceSpecCharacteristic().size() ).isEqualTo(11);
assertThat(specCirros.getServiceSpecCharacteristic().size() ).isEqualTo(10);
assertThat(specCirros.getServiceSpecCharacteristic().size() ).isEqualTo(12);
assertThat(sorder.getOrderItem().stream().findFirst().get().getService().getServiceCharacteristic().size() ).isEqualTo(2);
assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(15);
......@@ -224,15 +224,17 @@ public class ProcessOrderIntegrationTest {
assertThat( aservice ).isNotNull();
assertThat( aservice.getServiceCharacteristic().size() ).isEqualTo(11);
assertThat( aserviceCirros ).isNotNull();
assertThat( aserviceCirros.getServiceCharacteristic().size() ).isEqualTo(10);
assertThat( aserviceCirros.getServiceCharacteristic().size() ).isEqualTo(12);
assertThat( aservice.getServiceCharacteristicByName("Quality Class").getValue().getValue() ).isEqualTo( "1" );
assertThat( aservice.getServiceCharacteristicByName("cirros_2vnf_ns::OSM_CONFIG").getValue().getValue() ).contains( "eeeeeeee-8219-4580-9697-bf4a8f0a08f9" );
assertThat( aservice.getServiceCharacteristicByName("cirros_2vnf_ns::SSHKEY").getValue().getValue() ).isEqualTo( "MCKEYTESTINORDERExampleConcatSSHKEY_EnhancedByRule" );
//check that the cirros_2vnf_ns::SSHKEY value from the service order has been passed properly to the related RFS service
assertThat( aserviceCirros.getServiceCharacteristicByName("OSM_CONFIG").getValue().getValue() ).contains( "eeeeeeee-8219-4580-9697-bf4a8f0a08f9" );
assertThat( aserviceCirros.getServiceCharacteristicByName("SSHKEY").getValue().getValue() ).isEqualTo( "MCKEYTESTINORDERExampleConcatSSHKEY_EnhancedByRule" );
assertThat( aserviceCirros.getServiceCharacteristicByName("SSHKEY").getValue().getValue() ).isEqualTo( "MCKEYTESTINORDERExampleConcatSSHKEY_EnhancedByRule" );
assertThat( aserviceCirros.getServiceCharacteristicByName("AProgrammaticChar").getValue().getValue() ).isEqualTo( "AProgrammaticNSDIDValue" );
assertThat( aserviceCirros.getServiceCharacteristicByName("Another ProgrammaticChar").getValue().getValue() ).isEqualTo( "AnotherValue" );
//we will further check LCM rules!
......
......@@ -222,7 +222,12 @@ public class SCMocked {
InputStream in = new FileInputStream( sspec );
sspectext = IOUtils.toString(in, "UTF-8");
return sspectext;
}
} else if ( id.equals("89e027b5-24a9-4db7-b422-a963c9feeb7a") ) {
File sspec = new File( "src/test/resources/LcmCirrosRule1Test_CREATION.json" );
InputStream in = new FileInputStream( sspec );
sspectext = IOUtils.toString(in, "UTF-8");
return sspectext;
}
......@@ -241,13 +246,24 @@ public class SCMocked {
String sspectext = null;
if ( specid.equals("f2b74f90-4140-4895-80d1-ef243398117b") ) {
File sspec = new File( "src/test/resources/LcmRuleListSpecTest.json" );
InputStream in = new FileInputStream( sspec );
sspectext = IOUtils.toString(in, "UTF-8");
return sspectext;
}
if ( phaseName.equals("PRE_PROVISION") ) {
if ( specid.equals("f2b74f90-4140-4895-80d1-ef243398117b") ) {
File sspec = new File( "src/test/resources/LcmRuleListSpecTest.json" );
InputStream in = new FileInputStream( sspec );
sspectext = IOUtils.toString(in, "UTF-8");
return sspectext;
}
} else if ( phaseName.equals("CREATION") ) {
if ( specid.equals("f2b74f90-4140-4895-80d1-ef243398117b") ) {
File sspec = new File( "src/test/resources/LcmRuleListSpecTest_CREATION.json" );
InputStream in = new FileInputStream( sspec );
sspectext = IOUtils.toString(in, "UTF-8");
return sspectext;
}
}
return "[]";
......
{
"uuid": "40f027b5-24a9-4db7-b422-a963c9feeb7a",
"lastUpdate": null,
"@baseType": "BaseRootEntity",
"@schemaLocation": null,
"@type": "BaseEntity",
"href": null,
"name": "OSM config depending on class",
"description": "LCM Rule for specification Cirros Test OSM config depending on class",
"lifecycleStatus": "In study",
"version": null,
"validFor": null,
"id": "40f027b5-24a9-4db7-b422-a963c9feeb7a",
"lcmrulephase": "CREATION",
"content": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"controls_if\" id=\"ezIW/Lp7?d[u/A8`K!VJ\" x=\"43\" y=\"110\"><mutation elseif=\"1\" else=\"1\"></mutation><value name=\"IF0\"><block type=\"logic_compare\" id=\"*ekZcAZ_,XZz{;WB,g5W\"><field name=\"OP\">EQ</field><value name=\"A\"><block type=\"getcharval_number\" id=\"WExcKv2H!)rCDI[uT?rm\"><field name=\"AVALUE\">Quality Class</field></block></value><value name=\"B\"><block type=\"literal_integer\" id=\"l1f(k)+1cls`GzX_ZE6A\"><field name=\"NUM\">2</field></block></value></block></value><statement name=\"DO0\"><block type=\"setcharval_string\" id=\"?gCX.V1+thXHr$r!X|^G\"><field name=\"NAMELBL\">cirros_2vnf_ns::OSM_CONFIG</field><value name=\"AVALUE\"><block type=\"osm_nsd_config\" id=\"*$NIN2?#,%E{nqD.C,[s\"><value name=\"NSDID\"><block type=\"literal_text\" id=\"%1c/IuALgz7!-]C;U.2+\"><field name=\"TEXT\">0b6853fc-8219-4580-9697-bf4a8f0a08f9</field></block></value><value name=\"VIMID\"><block type=\"literal_text\" id=\"wZ*p#fJKDLhjG|d3a1}m\"><field name=\"TEXT\">c224eb48-419e-4097-8a1d-11ec1bba087f</field></block></value></block></value></block></statement><value name=\"IF1\"><block type=\"logic_compare\" id=\"RCkz91fa[t(de{:W8z*u\"><field name=\"OP\">EQ</field><value name=\"A\"><block type=\"getcharval_number\" id=\"YyY0L]PctE#C%jytEtsY\"><field name=\"AVALUE\">Quality Class</field></block></value><value name=\"B\"><block type=\"literal_integer\" id=\"$3qYjNBhPmr%U,I=*;0o\"><field name=\"NUM\">1</field></block></value></block></value><statement name=\"DO1\"><block type=\"setcharval_string\" id=\"$q~oAJSlb(%rrZBx,Uf!\"><field name=\"NAMELBL\">cirros_2vnf_ns::OSM_CONFIG</field><value name=\"AVALUE\"><block type=\"osm_nsd_config\" id=\"CTljtvin=U?WpZD@@qQ~\"><value name=\"NSDID\"><block type=\"literal_text\" id=\"1V.Jyzj3d0x:gTCq^w+?\"><field name=\"TEXT\">eeeeeeee-8219-4580-9697-bf4a8f0a08f9</field></block></value><value name=\"VIMID\"><block type=\"literal_text\" id=\"qZOf!wzN~MaebefmIvx7\"><field name=\"TEXT\">eeeeeeee-419e-4097-8a1d-11ec1bba087f</field></block></value></block></value></block></statement><statement name=\"ELSE\"><block type=\"setcharval_string\" id=\"JQY#%xIXLvPK*DzyCR{_\"><field name=\"NAMELBL\">cirros_2vnf_ns::OSM_CONFIG</field><value name=\"AVALUE\"><block type=\"osm_nsd_config\" id=\"a-tUtYg:mDk^Qbe@CMGt\"><value name=\"NSDID\"><block type=\"literal_text\" id=\"ZY)+_ENMfz?mjiX.7O4:\"><field name=\"TEXT\">cccccccc-8219-4580-9697-bf4a8f0a08f9</field></block></value><value name=\"VIMID\"><block type=\"literal_text\" id=\"alJ:3%fxZr73K~qQQ`G%\"><field name=\"TEXT\">cccccccc-419e-4097-8a1d-11ec1bba087f</field></block></value></block></value></block></statement></block></xml>",
"code": "{\r\n java.util.HashMap<String,String> charvals = new java.util.HashMap<>();\r\n charvals.put(\"AProgrammaticChar\",\"AProgrammaticNSDIDValue\");\r\n charvals.put(\"Another ProgrammaticChar\",\"AnotherValue\");\r\n createServiceRefIf(\"cirros_2vnf_ns\", !(getCharValFromStringType(\"cirros_2vnf_ns::PackagingFormat\").equals(\"\")==true), charvals);\r\n }",
"serviceSpecs": [
{
"@baseType": "BaseEntity",
"@schemaLocation": null,
"@type": null,
"href": null,
"name": "Cirros Test",
"version": null,
"targetServiceSchema": null,
"@referredType": null,
"id": "f2b74f90-4140-4895-80d1-ef243398117b"
}
]
}
\ No newline at end of file
[
{
"uuid": "89e027b5-24a9-4db7-b422-a963c9feeb7a",
"id": "89e027b5-24a9-4db7-b422-a963c9feeb7a",
"name": "OSM config depending on class",
"description": "LCM Rule for specification Cirros Test OSM config depending on class",
"lcmrulephase": "CREATION"
}
]
\ No newline at end of file
......@@ -499,6 +499,100 @@
},
"@valueSchemaLocation": null,
"id": "5c50dbe4-42f9-4d12-bed9-987c75b592d6"
},
{
"uuid": "3a50dbe4-42f9-4d12-bed9-987c75b592d6",
"@baseType": "BaseRootEntity",
"@schemaLocation": null,
"@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
"href": null,
"name": "AProgrammaticChar",
"configurable": false,
"description": "AProgrammaticChar dscription",
"extensible": null,
"isUnique": null,
"maxCardinality": 1,
"minCardinality": 1,
"regex": null,
"valueType": "TEXT",
"serviceSpecCharRelationship": [],
"serviceSpecCharacteristicValue": [
{
"uuid": "54e00574-6d22-4f48-8bd4-17884f895c13",
"@baseType": "BaseEntity",
"@schemaLocation": null,
"@type": null,
"href": null,
"isDefault": true,
"rangeInterval": null,
"regex": null,
"unitOfMeasure": "N/A",
"valueFrom": null,
"valueTo": null,
"valueType": null,
"validFor": {
"endDateTime": "2040-09-06T23:48:24+03:00",
"startDateTime": "2020-09-06T23:48:24+03:00"
},
"value": {
"value": "xzzx",
"alias": "AliASAProgrammaticChar"
}
}
],
"validFor": {
"endDateTime": "2040-09-06T23:48:24+03:00",
"startDateTime": "2020-09-06T23:48:24+03:00"
},
"@valueSchemaLocation": null,
"id": "5c50dbe4-42f9-4d12-bed9-987c75b592d6"
},
{
"uuid": "3a22dbe4-42f9-4d12-bed9-987c75b592d6",
"@baseType": "BaseRootEntity",
"@schemaLocation": null,
"@type": "org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic",
"href": null,
"name": "Another ProgrammaticChar",
"configurable": false,
"description": "Another AProgrammaticChar dscription",
"extensible": null,
"isUnique": null,
"maxCardinality": 1,
"minCardinality": 1,
"regex": null,
"valueType": "TEXT",
"serviceSpecCharRelationship": [],
"serviceSpecCharacteristicValue": [
{
"uuid": "54e00522-6d22-4f48-8bd4-17884f895c13",
"@baseType": "BaseEntity",
"@schemaLocation": null,
"@type": null,
"href": null,
"isDefault": true,
"rangeInterval": null,
"regex": null,
"unitOfMeasure": "N/A",
"valueFrom": null,
"valueTo": null,
"valueType": null,
"validFor": {
"endDateTime": "2040-09-06T23:48:24+03:00",
"startDateTime": "2020-09-06T23:48:24+03:00"
},
"value": {
"value": "aawwaa",
"alias": "AliASAProgrammaticChar"
}
}
],
"validFor": {
"endDateTime": "2040-09-06T23:48:24+03:00",
"startDateTime": "2020-09-06T23:48:24+03:00"
},
"@valueSchemaLocation": null,
"id": "5c50dbe4-42f9-4d12-bed9-987c75b592d6"
}
],
"serviceSpecRelationship": [],
......