Skip to content
Snippets Groups Projects
Commit 470f4c8d authored by trantzas's avatar trantzas
Browse files

Merge branch '1-create-first-version-of-metrico' into 'develop'

Updating initially created METRICO Resource Specification

See merge request !3
parents 7341bd78 7e320c6f
No related branches found
No related tags found
2 merge requests!5MR for Release 2024Q4,!3Updating initially created METRICO Resource Specification
Pipeline #11205 passed
......@@ -15,6 +15,7 @@ import org.etsi.osl.tmf.common.model.ELifecycle;
import org.etsi.osl.tmf.common.model.EValueType;
import org.etsi.osl.tmf.common.model.service.ResourceRef;
import org.etsi.osl.tmf.pm628.model.*;
import org.etsi.osl.tmf.rcm634.model.LogicalResourceSpecification;
import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate;
import org.etsi.osl.tmf.ri639.model.LogicalResource;
import org.etsi.osl.tmf.ri639.model.Resource;
......@@ -43,12 +44,12 @@ public class MetricoService extends RouteBuilder {
private static final Logger logger = LoggerFactory.getLogger(JobService.class);
public static final String OSL_METRICO_RSPEC_NAME = "metrico.osl.etsi.org";
public static final String OSL_METRICO_RSPEC_NAME = "METRICO_Resource_Specification";
public static final String OSL_METRICO_RSPEC_VERSION = "0.0.1";
public static final String OSL_METRICO_RSPEC_CATEGORY = "metrico.osl.etsi.org/v1";
public static final String OSL_METRICO_RESOURCE_CATEGORY = "metrico.osl.etsi.org/v1";
public static final String OSL_METRICO_RSPEC_TYPE = "LogicalResourceSpecification";
public static final String OSL_METRICO_RSPEC_DESCRIPTION = "This Specification is used to describe a generic KubernetesCRD";
public static final String OSL_METRICO_RSPEC_DESCRIPTION = "This Specification is used to describe a generic METRICO job resource";
@Value("${PM_MEASUREMENT_COLLECTION_JOB_UPDATE}")
private String PM_MEASUREMENT_COLLECTION_JOB_UPDATE = "";
......@@ -107,25 +108,33 @@ public class MetricoService extends RouteBuilder {
ResourceSpecificationCreate rsc = new ResourceSpecificationCreate();
rsc.setName( "METRICO_RESOURCE_SPECIFICATION" );
rsc.setName( OSL_METRICO_RSPEC_NAME );
rsc.setCategory( OSL_METRICO_RSPEC_CATEGORY );
rsc.setVersion( OSL_METRICO_RSPEC_VERSION );
rsc.setDescription( OSL_METRICO_RSPEC_DESCRIPTION );
rsc.setType( OSL_METRICO_RSPEC_TYPE );
rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() );
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_CHARACTERISTIC_NAME", "", EValueType.TEXT.getValue(), "Used for providing the characteristic of service _MT_SERVICEUUID to update", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_SERVICEUUID", "", EValueType.TEXT.getValue(), "Used for providing the id of the service to update", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_END_TIME", "", EValueType.TEXT.getValue(), "Used for providing the end time", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_START_TIME", "", EValueType.TEXT.getValue(), "Used for providing start time", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_RECURRING_INTERVAL", "G_1MN", EValueType.TEXT.getValue(), "Used for providing the polling interval of prometheus", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_TYPE", "PROMETHEUS", EValueType.TEXT.getValue(), "Used for providing ", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_QUERY", "", EValueType.TEXT.getValue(), "Used for providing the query towards prometheus", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_URL", "", EValueType.TEXT.getValue(), "Used for providing the prometheus URL", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_CHARACTERISTIC_NAME", "", EValueType.TEXT.getValue(), "The characteristic of the service with id _MT_SERVICEUUID that will be updated with monitoring metrics", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_SERVICEUUID", "", EValueType.TEXT.getValue(), "The id of the service to update", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_END_TIME", "", EValueType.TEXT.getValue(), "The ending time of the monitoring job", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_START_TIME", "", EValueType.TEXT.getValue(), "The starting time of the monitoring job", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_RECURRING_INTERVAL", "G_1MN", EValueType.TEXT.getValue(), "The polling interval of the monitoring source", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_TYPE", "PROMETHEUS", EValueType.TEXT.getValue(), "The monitoring source type", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_QUERY", "", EValueType.TEXT.getValue(), "The query towards the monitoring source (e.g. query=gnb_service_state)", false);
rsc.addResourceSpecificationCharacteristicItemShort( "_MT_URL", "", EValueType.TEXT.getValue(), "The monitoring source URL (e.g. https://prom.osl.etsi.org:9090)", false);
prometheusQueries.createOrUpdateResourceSpecByNameCategoryVersion(rsc);
LogicalResourceSpecification result = prometheusQueries.createOrUpdateResourceSpecByNameCategoryVersion(rsc);
while ( result == null ) {
try {
logger.info("Cannot get resource for registerMetricoResourceSpec. Retrying in 10 seconds" );
Thread.sleep( 10000 );
} catch (InterruptedException e) {
e.printStackTrace();
}
result = prometheusQueries.createOrUpdateResourceSpecByNameCategoryVersion(rsc);
}
}
......
......@@ -34,13 +34,13 @@ public class MetricoServiceTest {
DataAccessEndpoint dae = new DataAccessEndpoint();
dae.setApiType("PROMETHEUS");
dae.setUri(new URI("http://150.140.195.195:9090/api/v1/query?query=netdata_app_disk_physical_io_KiB_persec_average"));
dae.setUri(new URI("http://"));
dae.setUuid("123e4567-e89b-12d3-a456-426614174011");
List<DataAccessEndpoint> daeList = new ArrayList<>();
daeList.add(dae);
mcj.setDataAccessEndpoint(daeList);
//job.setDataAccessEndPointUri(new URI("http://150.140.195.195:9090/api/v1/query?query=up"));
//job.setDataAccessEndPointUri(new URI("http://"));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment