diff --git a/src/main/java/org/etsi/osl/tmf/ri639/api/ResourceApiRouteBuilder.java b/src/main/java/org/etsi/osl/tmf/ri639/api/ResourceApiRouteBuilder.java index fc6252fb05e6d79fbf958ccdbd8348d8fa1114b9..bc445f18d73265463f8a7e11f3eacc6f4e68a1d0 100644 --- a/src/main/java/org/etsi/osl/tmf/ri639/api/ResourceApiRouteBuilder.java +++ b/src/main/java/org/etsi/osl/tmf/ri639/api/ResourceApiRouteBuilder.java @@ -74,7 +74,7 @@ public class ResourceApiRouteBuilder extends RouteBuilder { public void configure() throws Exception { from( CATALOG_ADD_RESOURCE ) - .log(LoggingLevel.INFO, log, CATALOG_ADD_RESOURCE + " message received!") + .log(LoggingLevel.DEBUG, log, CATALOG_ADD_RESOURCE + " message received!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ResourceCreate.class, true) .bean( resourceRepoService, "addResource(${body})") @@ -83,13 +83,13 @@ public class ResourceApiRouteBuilder extends RouteBuilder { .convertBodyTo( String.class ); from( CATALOG_GET_RESOURCE_BY_ID ) - .log(LoggingLevel.INFO, log, CATALOG_GET_RESOURCE_BY_ID + " message received!") + .log(LoggingLevel.DEBUG, log, CATALOG_GET_RESOURCE_BY_ID + " message received!") .to("log:DEBUG?showBody=true&showHeaders=true") .bean( resourceRepoService, "getResourceEagerAsString") .convertBodyTo( String.class ); from( CATALOG_UPD_RESOURCE ) - .log(LoggingLevel.INFO, log, CATALOG_UPD_RESOURCE + " message received!") + .log(LoggingLevel.DEBUG, log, CATALOG_UPD_RESOURCE + " message received!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ResourceUpdate.class, true) .bean( resourceRepoService, "updateResource(${header.resourceId}, ${body}, ${header.triggerServiceActionQueue} )") @@ -97,14 +97,14 @@ public class ResourceApiRouteBuilder extends RouteBuilder { .convertBodyTo( String.class ); from( CATALOG_RESOURCES_OF_PARTNERS ) - .log(LoggingLevel.INFO, log, CATALOG_RESOURCES_OF_PARTNERS + " message received!") + .log(LoggingLevel.DEBUG, log, CATALOG_RESOURCES_OF_PARTNERS + " message received!") .to("log:DEBUG?showBody=true&showHeaders=true") .bean( resourceRepoService, "findAllActiveAndReservedResourcesOfPartners") .marshal().json( JsonLibrary.Jackson) .convertBodyTo( String.class ); from( CATALOG_UPDADD_RESOURCE ) - .log(LoggingLevel.INFO, log, CATALOG_UPDADD_RESOURCE + " message received!") + .log(LoggingLevel.DEBUG, log, CATALOG_UPDADD_RESOURCE + " message received!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ResourceCreate.class, true) .bean( resourceRepoService, "addOrUpdateResourceByNameCategoryVersion(${header.aname},${header.acategory}, ${header.aversion}, ${body})") diff --git a/src/main/java/org/etsi/osl/tmf/sim638/api/ServiceApiRouteBuilder.java b/src/main/java/org/etsi/osl/tmf/sim638/api/ServiceApiRouteBuilder.java index b1e68771a517dcf2964a114df51ce35337396cfc..84645c52620a08fc332dd9722fdfbd2b46e8b831 100644 --- a/src/main/java/org/etsi/osl/tmf/sim638/api/ServiceApiRouteBuilder.java +++ b/src/main/java/org/etsi/osl/tmf/sim638/api/ServiceApiRouteBuilder.java @@ -123,7 +123,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { from( CATALOG_ADD_SERVICE ) - .log(LoggingLevel.INFO, log, CATALOG_ADD_SERVICE + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_ADD_SERVICE + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ServiceCreate.class, true) .bean( serviceRepoService, "addService(${body})") @@ -131,7 +131,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { .convertBodyTo( String.class ); from( CATALOG_GET_SERVICE_BY_ID ) - .log(LoggingLevel.INFO, log, CATALOG_GET_SERVICE_BY_ID + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_GET_SERVICE_BY_ID + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .bean( serviceRepoService, "getServiceEagerAsString") .convertBodyTo( String.class ); @@ -139,7 +139,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { from( CATALOG_UPD_SERVICE ) - .log(LoggingLevel.INFO, log, CATALOG_UPD_SERVICE + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_UPD_SERVICE + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ServiceUpdate.class, true) .bean( serviceRepoService, "updateService(${header.serviceid}, ${body}, ${header.triggerServiceActionQueue} )") @@ -148,14 +148,14 @@ public class ServiceApiRouteBuilder extends RouteBuilder { from( CATALOG_SERVICE_QUEUE_ITEMS_GET ) - .log(LoggingLevel.INFO, log, CATALOG_SERVICE_QUEUE_ITEMS_GET + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_SERVICE_QUEUE_ITEMS_GET + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .bean( serviceRepoService, "findAllServiceActionQueueItems") .marshal().json( JsonLibrary.Jackson) .convertBodyTo( String.class ); from( CATALOG_SERVICE_QUEUE_ITEM_UPD ) - .log(LoggingLevel.INFO, log, CATALOG_SERVICE_QUEUE_ITEM_UPD + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_SERVICE_QUEUE_ITEM_UPD + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ServiceActionQueueItem.class, true) .bean( serviceRepoService, "updateServiceActionQueueItem(${body})") @@ -163,7 +163,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { .convertBodyTo( String.class ); from( CATALOG_SERVICE_QUEUE_ITEM_DELETE ) - .log(LoggingLevel.INFO, log, CATALOG_SERVICE_QUEUE_ITEM_DELETE + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_SERVICE_QUEUE_ITEM_DELETE + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ServiceActionQueueItem.class, true) .bean( serviceRepoService, "deleteServiceActionQueueItemByUuid(${header.itemid})"); @@ -171,7 +171,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { from( CATALOG_SERVICES_TO_TERMINATE ) - .log(LoggingLevel.INFO, log, CATALOG_SERVICES_TO_TERMINATE + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_SERVICES_TO_TERMINATE + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .bean( serviceRepoService, "findAllActiveServicesToTerminate") .marshal().json( JsonLibrary.Jackson) @@ -179,7 +179,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { from( CATALOG_SERVICES_OF_PARTNERS ) - .log(LoggingLevel.INFO, log, CATALOG_SERVICES_OF_PARTNERS + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_SERVICES_OF_PARTNERS + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .bean( serviceRepoService, "findAllActiveAndReservedServicesOfPartners") .marshal().json( JsonLibrary.Jackson) @@ -187,14 +187,14 @@ public class ServiceApiRouteBuilder extends RouteBuilder { from( CATALOG_GET_SERVICE_BY_ORDERID ) - .log(LoggingLevel.INFO, log, CATALOG_GET_SERVICE_BY_ORDERID + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, CATALOG_GET_SERVICE_BY_ORDERID + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .bean( serviceRepoService, "getServicesFromOrderID") .marshal().json( JsonLibrary.Jackson) .convertBodyTo( String.class ); from( NFV_CATALOG_NS_LCMCHANGED ) - .log(LoggingLevel.INFO, log, NFV_CATALOG_NS_LCMCHANGED + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, NFV_CATALOG_NS_LCMCHANGED + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, DeploymentDescriptor.class, true) .bean( serviceRepoService, "nfvCatalogNSResourceChanged(${body})"); @@ -202,7 +202,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { from( EVENT_RESOURCE_STATE_CHANGED ) - .log(LoggingLevel.INFO, log, EVENT_RESOURCE_STATE_CHANGED + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, EVENT_RESOURCE_STATE_CHANGED + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ResourceStateChangeNotification.class, true) .bean( serviceRepoService, "resourceStateChangedEvent(${body})"); @@ -216,7 +216,7 @@ public class ServiceApiRouteBuilder extends RouteBuilder { .logHandled(true) .retriesExhaustedLogLevel(LoggingLevel.ERROR) .retryAttemptedLogLevel(LoggingLevel.ERROR)) - .log(LoggingLevel.INFO, log, EVENT_RESOURCE_CREATE + " message received and will be processed for service inventory!") + .log(LoggingLevel.DEBUG, log, EVENT_RESOURCE_CREATE + " message received and will be processed for service inventory!") .to("log:DEBUG?showBody=true&showHeaders=true") .unmarshal().json( JsonLibrary.Jackson, ResourceCreateNotification.class, true) .bean( serviceRepoService, "resourceCreatedEvent(${body})"); diff --git a/src/main/java/org/etsi/osl/tmf/sim638/service/ServiceRepoService.java b/src/main/java/org/etsi/osl/tmf/sim638/service/ServiceRepoService.java index 9e7bb038f73479632e8f636bb600bbf8ab7cd946..b439bc9a62901f3745e264d06a48d0522117942c 100644 --- a/src/main/java/org/etsi/osl/tmf/sim638/service/ServiceRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/sim638/service/ServiceRepoService.java @@ -340,8 +340,27 @@ public class ServiceRepoService { noteItem.setDate(OffsetDateTime.now(ZoneOffset.UTC) ); s.addNoteItem(noteItem); - - s = this.serviceRepo.save( s ); + // double characteristic investigation + // + // + // int cnt = 0; + // if ( service.getServiceCharacteristic()!=null) + // for (Characteristic ch : service.getServiceCharacteristic()) { + // if ( ch.getName().equals( "org.etsi.osl.prefixName" ) ) { + // cnt++; + // } + // if ( ch.getName().equals( "AdditionPropertiesAsJson" ) ) { + // logger.debug("=============================================> FOUND CHARACTERISTIC addService AdditionPropertiesAsJson IN addService" ); + // logger.debug("=============================================> AdditionPropertiesAsJson charlength=" + ch.getValue().getValue().length() ); + // } + // } + + // if ( cnt>1) { + // logger.debug("=============================================> FOUND CHARACTERISTIC TWICE AFTER service addService" ); + + // } + + s = this.serviceRepo.save( s ); raiseServiceCreateNotification(s); return s; @@ -393,8 +412,44 @@ public class ServiceRepoService { e.printStackTrace(); } + // double characteristic investigation + // + // + // int cnt = 0; + // if ( servUpd.getServiceCharacteristic() != null ) { + // for (Characteristic ch1 : servUpd.getServiceCharacteristic()) { + // if ( ch1.getName().equals( "org.etsi.osl.prefixName" ) ) { + // cnt++; + // } + // if ( ch1.getName().equals( "AdditionPropertiesAsJson" ) ) { + // logger.debug("=============================================> FOUND CHARACTERISTIC AdditionPropertiesAsJson IN servUpd" ); + // logger.debug("=============================================> AdditionPropertiesAsJson charlength=" + ch1.getValue().getValue().length() ); + // } + + // } + + // if ( cnt>1) { + // logger.debug("=============================================> FOUND CHARACTERISTIC TWICE servUpd updateService servUpd" ); + + // } + // } + // cnt = 0; + // for (Characteristic ch : service.getServiceCharacteristic()) { + // if ( ch.getName().equals( "org.etsi.osl.prefixName" ) ) { + // cnt++; + // } + // if ( ch.getName().equals( "AdditionPropertiesAsJson" ) ) { + // logger.debug("=============================================> FOUND CHARACTERISTIC AdditionPropertiesAsJson IN service" ); + // logger.debug("=============================================> AdditionPropertiesAsJson charlength=" + ch.getValue().getValue().length() ); + // } + // } + + // if ( cnt>1) { + // logger.debug("=============================================> FOUND CHARACTERISTIC TWICE service updateService service" ); + + // } - + if (servUpd.getType()!=null) { service.setType(servUpd.getType()); } @@ -536,7 +591,19 @@ public class ServiceRepoService { } else { service.addServiceCharacteristicItem(n); - + // double characteristic investigation + // + // + // if ( n.getName().equals( "AdditionPropertiesAsJson" ) ) { + // logger.debug("=============================================> ADDING AdditionPropertiesAsJson to service" ); + // if ( n.getValue()!=null ) { + // logger.debug("=============================================> ADDING AdditionPropertiesAsJson charlength=" + n.getValue().getValue().length() ); + // } else { + + // logger.debug("=============================================> ADDING AdditionPropertiesAsJson charlength=NULL" ); + // } + + // } if ( !n.getName().contains("::") ) { //it is not a child characteristic serviceCharacteristicChanged = true; charChangedForNotes += n.getName() + ", "; @@ -613,6 +680,7 @@ public class ServiceRepoService { if (charChangedForNotes.contains( "reconciledAt") ) { //this is just a sync message, so we need to igore such changes serviceCharacteristicChanged = false; + logger.debug("=============================================> Just reconciledAt changed" ); } if (serviceCharacteristicChanged) { @@ -634,7 +702,25 @@ public class ServiceRepoService { service = this.serviceRepo.save( service ); - + // double characteristic investigation + // + // + // cnt = 0; + // for (Characteristic ch : service.getServiceCharacteristic()) { + // if ( ch.getName().equals( "org.etsi.osl.prefixName" ) ) { + // cnt++; + // } + // if ( ch.getName().equals( "AdditionPropertiesAsJson" ) ) { + // logger.debug("=============================================> FOUND CHARACTERISTIC AFTER AdditionPropertiesAsJson IN service" ); + // logger.debug("=============================================> AdditionPropertiesAsJson charlength=" + ch.getValue().getValue().length() ); + // } + // } + + // if ( cnt>1) { + // logger.debug("=============================================> FOUND CHARACTERISTIC TWICE AFTER service updateService service" ); + + // } + String requestedServiceAsJson = null; try { requestedServiceAsJson = mapper.writeValueAsString( service ); @@ -765,22 +851,6 @@ public class ServiceRepoService { } - Characteristic schart = service.getServiceCharacteristicByName("long_string"); - - if ( schart!= null ) { - String teest = schart.getValue().getValue(); - logger.info("schart size = " + teest.length() ); - - logger.info("schart " + teest ); - System.out.println("The value is : \n " + teest); -// try (PrintWriter out = new PrintWriter("C:\\tranoris\\ctranup\\personal\\Invoices\\filename.txt")) { -// out.println( teest ); -// } catch (FileNotFoundException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - } - return service; } @@ -890,15 +960,15 @@ public class ServiceRepoService { String res = mapper.writeValueAsString(s); - Characteristic schart = s.getServiceCharacteristicByName("long_string"); + // Characteristic schart = s.getServiceCharacteristicByName("long_string"); - if ( schart!= null ) { - String teest = schart.getValue().getValue(); - logger.debug("schart size = " + teest.length() ); + // if ( schart!= null ) { + // String teest = schart.getValue().getValue(); + // logger.debug("schart size = " + teest.length() ); - logger.debug("schart " + teest ); - logger.debug("======================================================================================================"); - } + // logger.debug("schart " + teest ); + // logger.debug("======================================================================================================"); + // } return res; } @@ -1155,16 +1225,14 @@ public class ServiceRepoService { public void updateServicesHavingThisSupportingResource(@Valid Resource res) { try { - logger.debug("Will update services related to this resource with id = " + res.getId() ); - + logger.debug("================> Will update services related to this resource with id = " + res.getId() ); var aservices = findServicesHavingThisSupportingResourceID( res.getId() ); - - logger.debug("services.found = " + aservices.size() ); for (Service as : aservices) { - Service aService = findByUuid(as.getId()); - + Service aService = getServiceEager(as.getId()); + + ServiceStateType nextState = aService.getState(); List rlist = new ArrayList(); for (ResourceRef rref : aService.getSupportingResource()) { Optional result = resourceRepo.findByUuid(rref.getId()); @@ -1172,28 +1240,99 @@ public class ServiceRepoService { rlist.add( result.get() ); } } - - rlist.add(res); //add also this one - ServiceStateType nextState = aService.findNextStateBasedOnSupportingResources(rlist); - - ServiceUpdate supd = new ServiceUpdate(); - supd.setState(nextState); - String stateText=""; - if ( !aService.getState().equals(nextState)) { - stateText = "State changed from " + aService.getState() + " to " + nextState + "."; + //copy characteristics, from resource to service + + /* + * Construct characteristic name + */ + String kind = ""; + String resourcename = res.getName() ; + + org.etsi.osl.tmf.ri639.model.Characteristic ckind = res.getResourceCharacteristicByName("Kind"); + if ( ckind != null && ckind.getValue() != null) { + kind = ckind.getValue().getValue() ; //example "ConfigMap" + } + + if ( res.getName().indexOf('@')>0) { + String firstToken = res.getName().substring( 0, res.getName().indexOf('@') ); + resourcename = firstToken ; //example "cr0fc1234-amf" + } + + Boolean resourceIsSameKind = aService.checkIsKindResource(res) || aService.getServiceCharacteristicByName("Kind")==null; //either Kind is the same or simply does not exist. Then behave the same + if (resourceIsSameKind) { //if this service is the same kind as the resource then don't prefix the characteristic + kind = ""; + resourcename=""; + //rlist.add(res); //add only this one + }else { + //enable the following to remove crXXXXXX prefix in name +// org.etsi.osl.tmf.ri639.model.Characteristic kubinstance = res.getResourceCharacteristicByName("app.kubernetes.io/instance"); +// if ( kubinstance != null && kubinstance.getValue() != null) { +// String removePrefix = kubinstance.getValue().getValue(); +// resourcename = resourcename.replace( removePrefix + "-", ""); +// resourcename = resourcename.replace( removePrefix, ""); +// } + kind = kind + "."; + resourcename = resourcename + "."; + } + + + Boolean stateChaged = false; + ServiceUpdate supd = new ServiceUpdate(); + nextState = aService.findNextStateBasedOnResourceList(rlist); + supd.setState(nextState); + String stateText=""; + if ( !aService.getState().equals(nextState)) { + stateChaged = true; + stateText = "State changed from " + aService.getState() + " to " + nextState + "."; + logger.debug("====================> stateText = " + stateText); + for (Resource r : rlist) { + logger.debug("==================> r:{}, state:{} ="+ r.getName() + ", "+ r.getResourceStatus().name()); + } + } + + //adding all characteristics from service + for (Characteristic ch : aService.getServiceCharacteristic()) { + supd.addServiceCharacteristicItem(ch); - //copy characteristics, from resource to service - - for (org.etsi.osl.tmf.ri639.model.Characteristic rChar : res.getResourceCharacteristic()) { - Characteristic cNew = new Characteristic(); - cNew.setName( rChar.getName()); - cNew.value( new Any( rChar.getValue() )); - supd.addServiceCharacteristicItem( cNew ); + } + + Boolean characteristicFoundDifferent =false; + String dontCopyChars = "clusterMasterURL,currentContextCluster,fullResourceName,Kind,apiGroup,UID,metadata"; + String[] arrayDontCopyChars = dontCopyChars.split(","); + Set setB = new HashSet<>(Arrays.asList(arrayDontCopyChars)); + for (org.etsi.osl.tmf.ri639.model.Characteristic rChar : res.getResourceCharacteristic()) { + if ( resourceIsSameKind || ( !setB.contains( rChar.getName()) && !rChar.getName().startsWith("org.etsi.osl") ) ){ //don;t copy characteristics in set + if ( rChar.getValue() != null ) { + + String characteristicname = kind + resourcename + rChar.getName(); + Characteristic servChar = supd.getServiceCharacteristicByName( characteristicname ); + if ( servChar != null && servChar.getValue() != null) { + if (! servChar.getValue().getValue().equals( rChar.getValue().getValue() ) ) { + characteristicFoundDifferent = true; + supd.getServiceCharacteristicByName( characteristicname ) .value(new Any( rChar.getValue() )); + logger.debug("====================> add characteristic: " + characteristicname +", value: "+ rChar.getValue().getValue()); + } + + } else { + Characteristic cNew = new Characteristic(); + cNew.setName( characteristicname ); + cNew.value( new Any( rChar.getValue() )); + supd.addServiceCharacteristicItem( cNew ); + characteristicFoundDifferent = true; + logger.debug("====================> add New characteristic: " + characteristicname +", value: "+ rChar.getValue().getValue()); + } + + + } } + + } + + if ( stateChaged || characteristicFoundDifferent) { Characteristic noteCheck = as.getServiceCharacteristicByName("_DETAILED_NOTES_"); if ( noteCheck!= null && noteCheck.getValue() != null @@ -1204,9 +1343,11 @@ public class ServiceRepoService { n.setAuthor( "SIM638-API" ); n.setDate( OffsetDateTime.now(ZoneOffset.UTC).toString() ); supd.addNoteItem( n ); - } + } this.updateService( aService.getId(), supd , true, null, null); //update the service + + } } @@ -1218,6 +1359,8 @@ public class ServiceRepoService { } + + @Transactional public void resourceCreatedEvent(@Valid ResourceCreateNotification resNotif) { try { @@ -1247,12 +1390,10 @@ public class ServiceRepoService { @Transactional private void updateServiceFromresourceChange(Resource res) { - + + addAnyNewRelatedResourcesFromKubernetesLabel(res); updateServicesHavingThisSupportingResource(res); - - addAnyNewRelatedResourcesFromKubernetesLabel(res); - - + } /** @@ -1273,7 +1414,7 @@ public class ServiceRepoService { String serviceId = res.getResourceCharacteristicByName("org.etsi.osl.serviceId").getValue().getValue(); logger.debug("rserviceId: " + serviceId); - Service aService = findByUuid( serviceId ); + Service aService = getServiceEager( serviceId ); if ( aService !=null ) { logger.debug("aService found "); Boolean resourceFoundInSupportedResourcesOfService = false; @@ -1292,14 +1433,7 @@ public class ServiceRepoService { rref.id(res.getId()).name(res.getName()); supd.addSupportingResourceItem(rref ); - //copy characteristics from resource to service - for (org.etsi.osl.tmf.ri639.model.Characteristic rChar : res.getResourceCharacteristic()) { - Characteristic cNew = new Characteristic(); - cNew.setName( rChar.getName()); - cNew.value( new Any( rChar.getValue() )); - supd.addServiceCharacteristicItem( cNew ); - } - + Note n = new Note(); n.setText("Supporting Resource "+ res.getId() + " Added in service" ); diff --git a/src/test/java/org/etsi/osl/services/api/sim638/ServiceRepoServiceTest.java b/src/test/java/org/etsi/osl/services/api/sim638/ServiceRepoServiceTest.java index 01249450a2a853e679938b4bbf9607ec7bf4147c..99e752ae1549a22b940d51f527b86a92a6fc0b81 100644 --- a/src/test/java/org/etsi/osl/services/api/sim638/ServiceRepoServiceTest.java +++ b/src/test/java/org/etsi/osl/services/api/sim638/ServiceRepoServiceTest.java @@ -247,6 +247,7 @@ public class ServiceRepoServiceTest { ResourceRef firstResourceRef = resourceRefList.get(0); Resource resource = resourceRepoService.findByUuid(firstResourceRef.getId()); + resource.setResourceStatus(ResourceStatusType.STANDBY); ResourceStateChangeNotification resourceCreateNotification = new ResourceStateChangeNotification(); ResourceStateChangeEvent event = new ResourceStateChangeEvent();