From 20040441d76b9523832a20d9308e7345c0eb9061 Mon Sep 17 00:00:00 2001 From: "RamaPrasad Amaranarayana (ra5425)" Date: Wed, 19 Sep 2018 18:42:40 -0400 Subject: Change Management Schedule Optimization Adding CMSO Service Code for Change Management Schedule Optimization Change-Id: Idac29c1f315c957851c1b0369fd7fb44804c9255 Issue-ID: OPTFRA-353 Signed-off-by: RamaPrasad Amaranarayana (ra5425) --- cmso-service/src/main/docker/Dockerfile | 5 + cmso-service/src/main/docker/startService.sh | 4 + .../main/java/org/onap/optf/cmso/Application.java | 109 ++ .../optf/cmso/AutowiringSpringBeanJobFactory.java | 67 ++ .../optf/cmso/CMSEnvironmentPostProcessor.java | 58 + .../org/onap/optf/cmso/CMSQuartzConfiguration.java | 129 +++ .../org/onap/optf/cmso/JerseyConfiguration.java | 106 ++ .../src/main/resources/application.properties | 55 + cmso-service/src/main/resources/banner.txt | 10 + cmso-service/src/main/resources/logback.xml | 377 +++++++ .../src/main/resources/logmessages.properties | 83 ++ .../main/resources/swagger-ui/dist/swagger.json | 1161 ++++++++++++++++++++ cmso-service/src/main/resources/system.properties | 48 + 13 files changed, 2212 insertions(+) create mode 100644 cmso-service/src/main/docker/Dockerfile create mode 100644 cmso-service/src/main/docker/startService.sh create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/Application.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/AutowiringSpringBeanJobFactory.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/CMSQuartzConfiguration.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java create mode 100644 cmso-service/src/main/resources/application.properties create mode 100644 cmso-service/src/main/resources/banner.txt create mode 100644 cmso-service/src/main/resources/logback.xml create mode 100644 cmso-service/src/main/resources/logmessages.properties create mode 100644 cmso-service/src/main/resources/swagger-ui/dist/swagger.json create mode 100644 cmso-service/src/main/resources/system.properties (limited to 'cmso-service/src') diff --git a/cmso-service/src/main/docker/Dockerfile b/cmso-service/src/main/docker/Dockerfile new file mode 100644 index 0000000..febb406 --- /dev/null +++ b/cmso-service/src/main/docker/Dockerfile @@ -0,0 +1,5 @@ +FROM anapsix/alpine-java:8_jdk +ADD cmso-0.1.0-SNAPSHOT.jar app.jar +ADD startService.sh /startService.sh +RUN chmod 700 /startService.sh +ENTRYPOINT ./startService.sh diff --git a/cmso-service/src/main/docker/startService.sh b/cmso-service/src/main/docker/startService.sh new file mode 100644 index 0000000..e7d3121 --- /dev/null +++ b/cmso-service/src/main/docker/startService.sh @@ -0,0 +1,4 @@ +#!/bin/sh +app_args=-Dspring.config.location=${APP_CONFIG_HOME} +echo "app_args ="${app_args} +java -Djava.security.egd=file:/dev/./urandom ${app_args} -Xms1024m -Xmx1024m -jar /app.jar diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/Application.java b/cmso-service/src/main/java/org/onap/optf/cmso/Application.java new file mode 100644 index 0000000..7327124 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/Application.java @@ -0,0 +1,109 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +package org.onap.optf.cmso; + +import java.net.InetAddress; +import java.util.TimeZone; +import javax.annotation.PostConstruct; +import org.apache.catalina.connector.Connector; +import org.onap.optf.cmso.common.LogMessages; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; +import org.springframework.boot.web.servlet.server.ServletWebServerFactory; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableAsync; +import com.att.eelf.configuration.Configuration; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +@SpringBootApplication +@ComponentScan(basePackages = {"org.onap.optf.cmso"}) +@EnableAsync +@EnableAutoConfiguration(exclude = { /*DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class*/ }) +public class Application extends SpringBootServletInitializer { + + private static EELFLogger log = EELFManager.getInstance().getLogger(Application.class); + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(Application.class); + } + + @Value("${server.dispatchPort:8089}") + private String dispatchPort; + + @PostConstruct + void started() { + // Make sure all datetimes are stored in UTC format. + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); + } + + public static void main(String[] args) { + initMDCData(); + SpringApplication.run(Application.class, args); + } + + protected static void initMDCData() { + MDC.clear(); + try { + MDC.put(Configuration.MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); + MDC.put("hostname", InetAddress.getLocalHost().getCanonicalHostName()); + MDC.put("serviceName", System.getProperty("info.build.artifact")); + MDC.put("version", System.getProperty("info.build.version")); + MDC.put(Configuration.MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); + } catch (Exception e) { + log.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); + } + } + + @Bean + public ServletWebServerFactory servletContainer() { + TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); + int port = Integer.parseInt(dispatchPort); + tomcat.addAdditionalTomcatConnectors(createStandardConnector(port)); + return tomcat; + } + + private Connector createStandardConnector(int port) { + Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); + connector.setScheme("http"); + connector.setPort(port); + return connector; + } +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/AutowiringSpringBeanJobFactory.java b/cmso-service/src/main/java/org/onap/optf/cmso/AutowiringSpringBeanJobFactory.java new file mode 100644 index 0000000..aad3104 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/AutowiringSpringBeanJobFactory.java @@ -0,0 +1,67 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +package org.onap.optf.cmso; + +import org.quartz.spi.TriggerFiredBundle; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.scheduling.quartz.SpringBeanJobFactory; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +/** + * This class makes it possible to use @Autowired references in QuartzJobBeans. + * + * Also enables @Autowire of the SchedulerFactoryBean the add Triggers + * for @Autowired QuartzJobBeans for ChangeManagement events. Making a big + * investment in SpringBoot Quartz. It had better work ;-) + * + */ +public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware { + private static EELFLogger log = EELFManager.getInstance().getLogger(AutowiringSpringBeanJobFactory.class); + + private transient AutowireCapableBeanFactory beanFactory; + + @Override + public void setApplicationContext(final ApplicationContext context) { + beanFactory = context.getAutowireCapableBeanFactory(); + } + + @Override + protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception { + final Object job = super.createJobInstance(bundle); + log.info("create job instance"); + beanFactory.autowireBean(job); + return job; + } +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java b/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java new file mode 100644 index 0000000..d1ccb7e --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java @@ -0,0 +1,58 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +package org.onap.optf.cmso; + +import java.util.HashMap; +import java.util.Map; +import org.onap.optf.cmso.common.PropertiesManagement; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.env.EnvironmentPostProcessor; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.MutablePropertySources; + +public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor { + + @Override + public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { + String pwd = environment.getProperty("cmso.database.password"); + if (pwd != null) { + pwd = PropertiesManagement.getDecryptedValue(pwd); + Map map = new HashMap(); + map.put("spring.datasource.password", pwd); + MapPropertySource propertySource = new MapPropertySource("abc", map); + MutablePropertySources proeprtySources = environment.getPropertySources(); + proeprtySources.addLast(propertySource); + } + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/CMSQuartzConfiguration.java b/cmso-service/src/main/java/org/onap/optf/cmso/CMSQuartzConfiguration.java new file mode 100644 index 0000000..5ae3f05 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/CMSQuartzConfiguration.java @@ -0,0 +1,129 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +package org.onap.optf.cmso; + +import org.onap.optf.cmso.eventq.CmQuartzJob; +import org.onap.optf.cmso.optimizer.OptimizerQuartzJob; +import org.onap.optf.cmso.sostatus.ScheduleStatusJob; +import org.quartz.spi.JobFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.quartz.JobDetailFactoryBean; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; +import org.springframework.scheduling.quartz.SimpleTriggerFactoryBean; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@ComponentScan({"org.onap.optf.cmso"}) +@EnableTransactionManagement +public class CMSQuartzConfiguration { + + @Autowired + Environment env; + + @Bean + public SimpleTriggerFactoryBean eventqTriggerFactoryBean() { + + Integer interval = env.getProperty("cmso.cm.polling.job.interval.ms", Integer.class, 60000); + SimpleTriggerFactoryBean stFactory = new SimpleTriggerFactoryBean(); + stFactory.setJobDetail(eventqDetailFactoryBean().getObject()); + stFactory.setStartDelay(3000); + stFactory.setRepeatInterval(interval); + // Indefinitely + return stFactory; + } + + @Bean + public JobDetailFactoryBean eventqDetailFactoryBean() { + JobDetailFactoryBean factory = new JobDetailFactoryBean(); + factory.setJobClass(CmQuartzJob.class); + return factory; + } + + @Bean + public SimpleTriggerFactoryBean statusTriggerFactoryBean() { + + Integer interval = env.getProperty("cmso.status.job.interval.ms", Integer.class, 60000); + SimpleTriggerFactoryBean stFactory = new SimpleTriggerFactoryBean(); + stFactory.setJobDetail(statusDetailFactoryBean().getObject()); + stFactory.setStartDelay(3000); + stFactory.setRepeatInterval(interval); + // Indefinitely + return stFactory; + } + + @Bean + public JobDetailFactoryBean statusDetailFactoryBean() { + JobDetailFactoryBean factory = new JobDetailFactoryBean(); + factory.setJobClass(ScheduleStatusJob.class); + return factory; + } + + @Bean + public SimpleTriggerFactoryBean optimizerTriggerFactoryBean() { + + Integer interval = env.getProperty("cmso.optimizer.job.interval.ms", Integer.class, 60000); + SimpleTriggerFactoryBean stFactory = new SimpleTriggerFactoryBean(); + stFactory.setJobDetail(optimizerDetailFactoryBean().getObject()); + stFactory.setStartDelay(3000); + stFactory.setRepeatInterval(interval); + // Indefinitely + return stFactory; + } + + @Bean + public JobDetailFactoryBean optimizerDetailFactoryBean() { + JobDetailFactoryBean factory = new JobDetailFactoryBean(); + factory.setJobClass(OptimizerQuartzJob.class); + return factory; + } + + @Bean + public JobFactory jobFactory(ApplicationContext applicationContext) { + AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory(); + jobFactory.setApplicationContext(applicationContext); + return jobFactory; + } + + @Bean + public SchedulerFactoryBean cmsoFactoryBean(JobFactory jobFactory) { + SchedulerFactoryBean cmso = new SchedulerFactoryBean(); + cmso.setJobFactory(jobFactory); + cmso.setTriggers(eventqTriggerFactoryBean().getObject(), optimizerTriggerFactoryBean().getObject(), + statusTriggerFactoryBean().getObject()); + return cmso; + } +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java b/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java new file mode 100644 index 0000000..8d9cb60 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java @@ -0,0 +1,106 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +package org.onap.optf.cmso; + +import java.util.logging.Logger; +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.logging.LoggingFeature; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.servlet.ServletProperties; +import org.onap.optf.cmso.dispatcher.rs.DispatcherServiceImpl; +import org.onap.optf.cmso.filters.CMSOContainerFilters; +import org.onap.optf.cmso.service.rs.AdminToolImpl; +import org.onap.optf.cmso.service.rs.CMSCallbackImpl; +import org.onap.optf.cmso.service.rs.CMSOServiceImpl; +import org.onap.optf.cmso.service.rs.HealthCheckImpl; +import org.onap.optf.cmso.test.loopback.SchedulerTestLoopbackServiceImpl; +import org.onap.optf.cmso.test.loopback.TicketMgtLoopbackServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Component +@ApplicationPath("/") +public class JerseyConfiguration extends ResourceConfig { + private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName()); + + @Bean + @Primary + public ObjectMapper objectMapper() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES); + objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + return objectMapper; + } + + @Autowired + public JerseyConfiguration( /* LogRequestFilter lrf */ ) { + register(CMSOServiceImpl.class); + register(CMSCallbackImpl.class); + register(SchedulerTestLoopbackServiceImpl.class); + register(TicketMgtLoopbackServiceImpl.class); + register(HealthCheckImpl.class); + register(AdminToolImpl.class); + register(DispatcherServiceImpl.class); + property(ServletProperties.FILTER_FORWARD_ON_404, true); + // TODO: ONAP Conversion identify appropriate ONAP logging filters if any + // register(lrf, 6001); + // register(LogResponseFilter.class, 6004); + + // TODO: Examine which logging features to enable + register(new LoggingFeature(log)); + register(CMSOContainerFilters.class); + } + + @Bean + public Client jerseyClient() { + ClientConfig client = new ClientConfig(); + + // TODO: ONAP Conversion identify appropriate ONAP logging filters if any + // client.register(TransactionIdRequestFilter.class); + // client.register(TransactionIdResponseFilter.class); + // client.register(DateTimeParamConverterProvider.class); + + return ClientBuilder.newClient(client); + } +} diff --git a/cmso-service/src/main/resources/application.properties b/cmso-service/src/main/resources/application.properties new file mode 100644 index 0000000..b6239c9 --- /dev/null +++ b/cmso-service/src/main/resources/application.properties @@ -0,0 +1,55 @@ +#------------------------------------------------------------------------------- +# Copyright 2017-2018 AT&T Intellectual Property. +# Modifications Copyright 2018 IBM. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the ??License?); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------------- + +info.build.artifact=@project.artifactId@ +info.build.name=@project.name@ +info.build.description=@project.description@ +info.build.version=@project.version@ + +spring.jersey.type=filter +spring.mvc.urls=swagger,docs,prometheus +server.contextPath=/cmso + +#This property is used to set the Tomcat connector attributes.developers can define multiple attributes separated by comma +#tomcat.connector.attributes=allowTrace-true + +#The max number of active threads in this pool +server.tomcat.max-threads=200 + +#The minimum number of threads always kept alive +server.tomcat.min-spare-threads=25 + +# External API port +server.port=8080 +# Internal dispatch port +server.dispatchPort=8089 + +kubernetes.namespace=org.onap.optf.cmso diff --git a/cmso-service/src/main/resources/banner.txt b/cmso-service/src/main/resources/banner.txt new file mode 100644 index 0000000..aa04dbb --- /dev/null +++ b/cmso-service/src/main/resources/banner.txt @@ -0,0 +1,10 @@ +#----------------------------------------------------------- + ____ ____ ____________ ________ ________ ____ + / __ \/ __ \/_ __/ ____/ / ____/ |/ / ___// __ \ + / / / / /_/ / / / / /_ / / / /|_/ /\__ \/ / / / + / /_/ / ____/ / / / __/ / /___/ / / /___/ / /_/ / + \____/_/ /_/ /_/ \____/_/ /_//____/\____/ + +${archetype.name}-Version:${archetype.version} + +#----------------------------------------------------------- \ No newline at end of file diff --git a/cmso-service/src/main/resources/logback.xml b/cmso-service/src/main/resources/logback.xml new file mode 100644 index 0000000..d283b19 --- /dev/null +++ b/cmso-service/src/main/resources/logback.xml @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${defaultPattern} + + + + + + + + + + + ${logDirectory}/${generalLogName}.log + + ${logDirectory}/${generalLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + + 256 + + + + + + ${logDirectory}/${securityLogName}.log + + ${logDirectory}/${securityLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + + 256 + 0 + + + + + + ${logDirectory}/${performanceLogName}.log + + ${logDirectory}/${performanceLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + + ${logDirectory}/${serverLogName}.log + + ${logDirectory}/${serverLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + + + ${logDirectory}/${policyLogName}.log + + ${logDirectory}/${policyLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + + + + ${logDirectory}/${auditLogName}.log + + ${logDirectory}/${auditLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${auditLoggerPattern} + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${metricsLoggerPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${errorLoggerPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + ${debugLogDirectory}/${debugLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${debugLoggerPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cmso-service/src/main/resources/logmessages.properties b/cmso-service/src/main/resources/logmessages.properties new file mode 100644 index 0000000..09d9312 --- /dev/null +++ b/cmso-service/src/main/resources/logmessages.properties @@ -0,0 +1,83 @@ +#------------------------------------------------------------------------------- +# Copyright 2017-2018 AT&T Intellectual Property. +# Modifications Copyright 2018 IBM. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the ??License?); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------------- + +# Generated from org.onap.optf.cmso.common.LogMessages +SEARCH_SCHEDULE_REQUEST_DETAILS SEARCH_SCHEDULE_REQUEST_DETAILS|Search Schedule Request Details {0} from {1}: {2}|No resolution needed|No action is required +SEARCH_SCHEDULE_REQUEST SEARCH_SCHEDULE_REQUEST|Search Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required +CREATE_SCHEDULE_REQUEST CREATE_SCHEDULE_REQUEST|Create Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required +DELETE_SCHEDULE_REQUEST DELETE_SCHEDULE_REQUEST|Delete Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required +GET_SCHEDULE_REQUEST_INFO GET_SCHEDULE_REQUEST_INFO|Get Schedule Request Info {0} from {1}: {2} : {3}|No resolution needed|No action is required +PROCESS_OPTIMIZER_CALLBACK PROCESS_OPTIMIZER_CALLBACK|Change management optimizer callback {0} from {1}: {2} |No resolution needed|No action is required +APPROVE_SCHEDULE_REQUEST APPROVE_SCHEDULE_REQUEST|Approve Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required +SCHEDULE_ALREADY_EXISTS SCHEDULE_ALREADY_EXISTS|Schedule already exists domain={0} schedule id={1}|No resolution needed|No action is required +SCHEDULE_NOT_FOUND SCHEDULE_NOT_FOUND|Schedule not found domain={0} schedule id={1}|No resolution needed|No action is required +INVALID_ATTRIBUTE INVALID_ATTRIBUTE|Invalid attribute {0}={1}|No resolution needed|No action is required +MISSING_REQUIRED_ATTRIBUTE MISSING_REQUIRED_ATTRIBUTE|Missing required attribute '{0}'|No resolution needed|No action is required +INVALID_REQUEST INVALID_REQUEST|The input data structure is incorrect|No resolution needed|No action is required +REQUEST_TIMED_OUT REQUEST_TIMED_OUT|Request timed out.|No resolution needed|No action is required +UNEXPECTED_EXCEPTION UNEXPECTED_EXCEPTION|Unexpected exception encountered during processing. Please contact support : {0}|No resolution needed|No action is required +AUTHORIZATION_FAILED AUTHORIZATION_FAILED|Authorization Failed|No resolution needed|No action is required +UNDEFINED_DOMAIN_DATA_ATTRIBUTE UNDEFINED_DOMAIN_DATA_ATTRIBUTE|Domain data attribute not defined domain={0} name={1} value={2}|No resolution needed|No action is required +UNDEFINED_FILTER_ATTRIBUTE UNDEFINED_FILTER_ATTRIBUTE|Undefined filter attribute {0}|No resolution needed|No action is required +INVALID_DATE_FILTER INVALID_DATE_FILTER|Invalid date filter provided {0}=(1}|No resolution needed|No action is required +OPTIMIZER_QUARTZ_JOB OPTIMIZER_QUARTZ_JOB|Quartz scheduling of OptimizerQuartzJob: {0}|No resolution needed|No action is required +OPTIMIZER_EXCEPTION OPTIMIZER_EXCEPTION|Exception making client call to optimizer {0}|No resolution needed|No action is required +OPTIMIZER_CALLBACK_STATE_ERROR OPTIMIZER_CALLBACK_STATE_ERROR|Optimizer callback on schedule in invalid state. Should be {0} but was {1}.|No resolution needed|No action is required +CHANGE_MANAGEMENT_GROUP_NOT_FOUND CHANGE_MANAGEMENT_GROUP_NOT_FOUND|ChangeManagementGroup not found on optimizer callback scheduleId={0} groupId={1}|No resolution needed|No action is required +UNABLE_TO_ALLOCATE_VNF_TIMESLOTS UNABLE_TO_ALLOCATE_VNF_TIMESLOTS|Unable to allocate VNF timeslots with Optimizer results startTime={0}, latestStartTime={1}, totalDuration={2}, concurrency={3} nvfs={4}|No resolution needed|No action is required +UNABLE_TO_LOCATE_SCHEDULE_DETAIL UNABLE_TO_LOCATE_SCHEDULE_DETAIL|Unable to locate ChangeManagementSchedule for VNF. scheduleId={0}, groupId={1}, vnfName={2}|No resolution needed|No action is required +CM_JOB CM_JOB|Quartz scheduling of CmJob: {0}|No resolution needed|No action is required +CM_QUARTZ_JOB CM_QUARTZ_JOB|Quartz scheduling of CmQuartzJob: {0}|No resolution needed|No action is required +NOT_PENDING_APPROVAL NOT_PENDING_APPROVAL|Approval request received for schedule that is not in Pending Approval state: domain={0} scheduleId={1} state={3}|No resolution needed|No action is required +SCHEDULE_PAST_DUE SCHEDULE_PAST_DUE|Attempt to dispatch an event that is Past due scheduleId={0}, vnf={1}, now={2}, startTime={3}|No resolution needed|No action is required +MSO_POLLING_MISSING_SCHEDULE MSO_POLLING_MISSING_SCHEDULE|Attempt to poll MSO for request id {1} for missing ChangeManagementSchedule id={0}|No resolution needed|No action is required +MSO_STATUS_JOB MSO_STATUS_JOB|Polling MSO {0} for requestId={1} for id={2}|No resolution needed|No action is required +UNEXPECTED_RESPONSE UNEXPECTED_RESPONSE|Unexpected response from {0} HTTP Status={1} : {2}|No resolution needed|No action is required +SCHEDULE_STATUS_JOB SCHEDULE_STATUS_JOB|Quartz scheduling of ScheduleStatusJob: {0}|No resolution needed|No action is required +CM_TICKET_NOT_APPROVED CM_TICKET_NOT_APPROVED|Attempt to dispatch a change management event that has no TM Ticket approved. scheduleId={0} VNF Name={1} TM ChangeId={2} Status={3} Approval Status={4}|No resolution needed|No action is required +MULTIPLE_GROUPS_NOT_SUPPORTED MULTIPLE_GROUPS_NOT_SUPPORTED|Multiple groups not supported on immediate requests|No resolution needed|No action is required +TM_CREATE_CHANGE_RECORD TM_CREATE_CHANGE_RECORD|TM Create Change Record:{0} : Schedule ID: {1}|No resolution needed|No action is required +TM_LIST TM_LIST|TM list:{0} : URL : {1}|No resolution needed|No action is required +TM_API TM_API|TM API Call: URL : {0}|No resolution needed|No action is required +UNABLE_TO_CREATE_CHANGE_TICKET UNABLE_TO_CREATE_CHANGE_TICKET|Unable to create change ticket in TM: Schedule ID: {0} : Reason : {1}|No resolution needed|No action is required +TM_UPDATE_CHECKLIST TM_UPDATE_CHECKLIST|TM Fetch Checklist:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}|No resolution needed|No action is required +OPTIMIZER_REQUEST OPTIMIZER_REQUEST|Optimi Request:{0} : Schedule ID: {1} : URL : {2}|No resolution needed|No action is required +TM_CLOSE_CHANGE_RECORD TM_CLOSE_CHANGE_RECORD|TM Close Change Record:{0} : Schedule ID: {1} : Change Id : {2}|No resolution needed|No action is required +UNABLE_TO_CLOSE_CHANGE_TICKET UNABLE_TO_CLOSE_CHANGE_TICKET|Unable to close change ticket in TM: Schedule ID: {0} : changeid: {1} : Reason: {2}|No resolution needed|No action is required +CANNOT_CANCEL_IN_PROGRESS CANNOT_CANCEL_IN_PROGRESS|Cannot delete/cancel a schedule with events in progress.|No resolution needed|No action is required +UNABLE_TO_PARSE_SCHEDULING_INFO UNABLE_TO_PARSE_SCHEDULING_INFO|Cannot parse scheduling info.|No resolution needed|No action is required +UNABLE_TO_LOCATE_CHANGE_RECORD UNABLE_TO_LOCATE_CHANGE_RECORD|Unable to locate TM change record {2} to check status before displacth of {1} for schedulId={0}|No resolution needed|No action is required +INVALID_CHANGE_WINDOW INVALID_CHANGE_WINDOW|Change window end time {1} must be after start time {0}|No resolution needed|No action is required +NODE_LIST_CONTAINS_EMTPY_NODE NODE_LIST_CONTAINS_EMTPY_NODE|vnfDetails node list contains at least one empty node.|No resolution needed|No action is required +SO_API SO_API|SO Poll Request {0}|No resolution needed|No action is required +EXPECTED_EXCEPTION EXPECTED_EXCEPTION|Expected exception encountered during processing. Make Sonar happy: {0}|No resolution needed|No action is required +TM_UPDATE_CHANGE_RECORD TM_UPDATE_CHANGE_RECORD|TM Update Change Record:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}|No resolution needed|No action is required +UNABLE_TO_UPDATE_CHANGE_TICKET UNABLE_TO_UPDATE_CHANGE_TICKET|Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} : Reason: {2}|No resolution needed|No action is required diff --git a/cmso-service/src/main/resources/swagger-ui/dist/swagger.json b/cmso-service/src/main/resources/swagger-ui/dist/swagger.json new file mode 100644 index 0000000..95bd771 --- /dev/null +++ b/cmso-service/src/main/resources/swagger-ui/dist/swagger.json @@ -0,0 +1,1161 @@ +{ + "swagger" : "2.0", + "info" : { + "version" : "0.1.0-SNAPSHOT", + "title" : "cmso" + }, + "basePath" : "/cmso", + "paths" : { + "/{apiVersion}/admin/{id}" : { + "get" : { + "summary" : "", + "description" : "Returns encrypted value of id.", + "operationId" : "exec", + "produces" : [ "text/plain" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1|v2", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "id", + "in" : "path", + "description" : "Identifier", + "required" : true, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "OK", + "schema" : { + "type" : "string" + } + }, + "400" : { + "description" : "Request failed" + } + } + } + }, + "/{apiVersion}/health" : { + "get" : { + "summary" : "", + "description" : "Returns health status of server.", + "operationId" : "healthCheck", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "checkInterfaces", + "in" : "query", + "description" : "Check Interfaces", + "required" : false, + "type" : "array", + "items" : { + "type" : "boolean", + "default" : true + }, + "collectionFormat" : "multi" + } ], + "responses" : { + "200" : { + "description" : "OK", + "schema" : { + "$ref" : "#/definitions/HealthCheckMessage" + } + }, + "400" : { + "description" : "Not healthy", + "schema" : { + "$ref" : "#/definitions/HealthCheckMessage" + } + } + } + } + }, + "/{apiVersion}/optimizerCallback" : { + "post" : { + "summary" : "", + "description" : "Processes optimizer results callback to a Pending Optimization schedule.", + "operationId" : "sniroCallback", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "in" : "body", + "name" : "body", + "description" : "Return schedules > lastScheduleId", + "required" : false, + "schema" : { + "$ref" : "#/definitions/Response from schedule optimizer" + } + } ], + "responses" : { + "200" : { + "description" : "OK" + }, + "500" : { + "description" : "Unexpected Runtime error" + } + } + } + }, + "/{apiVersion}/schedules" : { + "get" : { + "summary" : "", + "description" : "Returns a list of Scheduler Requests based upon the filter criteria.", + "operationId" : "searchScheduleRequests", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "includeDetails", + "in" : "query", + "description" : "Include details", + "required" : false, + "type" : "boolean", + "default" : false + }, { + "name" : "scheduleId", + "in" : "query", + "description" : "Schedule identifier", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "scheduleName", + "in" : "query", + "description" : "Schedule name", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "userId", + "in" : "query", + "description" : "SCheduler creator User id of ", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "status", + "in" : "query", + "description" : "Schedule status", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "createDateTime", + "in" : "query", + "description" : "Creation date and time ([,])", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "optimizerStatus", + "in" : "query", + "description" : "Optimizer status", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "WorkflowName", + "in" : "query", + "description" : "Workflow", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + } ], + "responses" : { + "200" : { + "description" : "OK", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Schedule" + } + } + }, + "404" : { + "description" : "No records found", + "schema" : { + "$ref" : "#/definitions/CMSRequestError" + } + }, + "500" : { + "description" : "Unexpected Runtime error" + } + } + } + }, + "/{apiVersion}/schedules/scheduleDetails" : { + "get" : { + "summary" : "", + "description" : "Returns a list of Schedule request details based upon the filter criteria.", + "operationId" : "searchScheduleRequestDetails", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "request.scheduleId", + "in" : "query", + "description" : "Schedule identifier", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.scheduleName", + "in" : "query", + "description" : "Schedule name", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.userId", + "in" : "query", + "description" : "Scheduler creator User id of ", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.status", + "in" : "query", + "description" : "Schedule status", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.createDateTime", + "in" : "query", + "description" : "Creation date and time ([,])", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.optimizerStatus", + "in" : "query", + "description" : "Optimizer status", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.approvalUserId", + "in" : "query", + "description" : "Request Approval user id", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.approvalStatus", + "in" : "query", + "description" : "Request Approval status", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "request.approvalType", + "in" : "query", + "description" : "Request Approval type", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "WorkflowName", + "in" : "query", + "description" : "Workflow", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "vnfName", + "in" : "query", + "description" : "VNF Name", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "vnfId", + "in" : "query", + "description" : "VNF Id", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "vnfStatus", + "in" : "query", + "description" : "VNF Status", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "startTime", + "in" : "query", + "description" : "Start time ,", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "finishTime", + "in" : "query", + "description" : "Finish time ,", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "lastInstanceTime", + "in" : "query", + "description" : "Last instance start time ,", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "tmChangeId", + "in" : "query", + "description" : "TM Change Ticket Change Id", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi" + }, { + "name" : "maxSchedules", + "in" : "query", + "description" : "Maximum number of schedules to return", + "required" : false, + "type" : "integer", + "format" : "int32" + }, { + "name" : "lastScheduleId", + "in" : "query", + "description" : "Return schedules > lastScheduleId", + "required" : false, + "type" : "string" + }, { + "name" : "request.concurrencyLimit", + "in" : "query", + "description" : "Return concurrencyLimit", + "required" : false, + "type" : "integer", + "format" : "int32" + } ], + "responses" : { + "200" : { + "description" : "OK", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/CmDetailsMessage" + } + } + }, + "404" : { + "description" : "No records found", + "schema" : { + "$ref" : "#/definitions/CMSRequestError" + } + }, + "500" : { + "description" : "Unexpected Runtime error" + } + } + } + }, + "/{apiVersion}/schedules/{scheduleId}" : { + "get" : { + "summary" : "", + "description" : "Retrieve the schedule request for scheduleId", + "operationId" : "getScheduleRequestInfo", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "scheduleId", + "in" : "path", + "description" : "Schedule id to uniquely identify the schedule info being retrieved.", + "required" : true, + "type" : "string" + } ], + "responses" : { + "200" : { + "description" : "OK", + "schema" : { + "$ref" : "#/definitions/Schedule" + } + }, + "404" : { + "description" : "No record found" + }, + "500" : { + "description" : "Unexpected Runtime error" + } + } + }, + "post" : { + "summary" : "", + "description" : "Creates a schedule request for scheduleId", + "operationId" : "createScheduleRequest", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "scheduleId", + "in" : "path", + "description" : "Schedule id to uniquely identify the schedule request being created.", + "required" : true, + "type" : "string" + }, { + "in" : "body", + "name" : "body", + "description" : "Data for creating a schedule request for the given schedule id", + "required" : false, + "schema" : { + "$ref" : "#/definitions/CMSMessage" + } + } ], + "responses" : { + "202" : { + "description" : "Schedule request accepted for optimization." + }, + "409" : { + "description" : "Schedule request already exists for this schedule id.", + "schema" : { + "$ref" : "#/definitions/CMSRequestError" + } + }, + "500" : { + "description" : "Unexpected Runtime error" + } + } + }, + "delete" : { + "summary" : "", + "description" : "Cancels the schedule request for scheduleId", + "operationId" : "deleteScheduleRequest", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "scheduleId", + "in" : "path", + "description" : "Schedule id to uniquely identify the schedule request being deleted.", + "required" : true, + "type" : "string" + } ], + "responses" : { + "204" : { + "description" : "Delete successful" + }, + "404" : { + "description" : "No record found", + "schema" : { + "$ref" : "#/definitions/CMSRequestError" + } + }, + "500" : { + "description" : "Unexpected Runtime error" + } + } + } + }, + "/{apiVersion}/schedules/{scheduleId}/approvals" : { + "post" : { + "summary" : "", + "description" : "Adds an accept/reject approval status to the schedule request identified by scheduleId", + "operationId" : "approveScheduleRequest", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "apiVersion", + "in" : "path", + "description" : "v1", + "required" : true, + "type" : "string", + "default" : "v1" + }, { + "name" : "scheduleId", + "in" : "path", + "description" : "Schedule id to uniquely identify the schedule request being accepted or rejected.", + "required" : true, + "type" : "string" + }, { + "in" : "body", + "name" : "body", + "description" : "Accept or reject approval message", + "required" : false, + "schema" : { + "$ref" : "#/definitions/Schedule Approval Request" + } + } ], + "responses" : { + "200" : { + "description" : "OK" + }, + "404" : { + "description" : "No record found" + }, + "500" : { + "description" : "Unexpected Runtime error" + } + } + } + } + }, + "definitions" : { + "CMSMessage" : { + "type" : "object", + "properties" : { + "domain" : { + "type" : "string", + "description" : "Schedule domain : ChangeManagement" + }, + "scheduleId" : { + "type" : "string", + "description" : "Schedule id that must be unique within the domain. Use of UUID is highly recommended." + }, + "scheduleName" : { + "type" : "string", + "description" : "User provided name of the schedule (deaults to scheduleId" + }, + "userId" : { + "type" : "string", + "description" : "ATTUID of the user requesting the schedule." + }, + "domainData" : { + "type" : "array", + "description" : "Domain data as name value/pairs. (i.e. CallbackUrl, CallbackData, WorkflowName)", + "items" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + } + }, + "schedulingInfo" : { + "$ref" : "#/definitions/Change Management Scheduling Info" + } + } + }, + "CMSRequestError" : { + "type" : "object", + "properties" : { + "requestError" : { + "$ref" : "#/definitions/RequestError" + } + } + }, + "CMSchedule" : { + "type" : "object", + "properties" : { + "groupId" : { + "type" : "string" + }, + "startTime" : { + "type" : "string" + }, + "finishTime" : { + "type" : "string" + }, + "latestInstanceStartTime" : { + "type" : "string" + }, + "node" : { + "type" : "array", + "items" : { + "type" : "string" + } + } + } + }, + "Change Management Group" : { + "type" : "object", + "properties" : { + "finishTime" : { + "type" : "string", + "description" : "Date/time by which all of the workflows should be completed." + }, + "groupId" : { + "type" : "string", + "description" : "Name of the group of VNFs to be scheduled" + }, + "lastInstanceStartTime" : { + "type" : "string", + "description" : "The latest date/time by which a workflow is to be started." + }, + "startTime" : { + "type" : "string", + "description" : "The date/time when workflows are to be started." + }, + "additionalDurationInSecs" : { + "type" : "integer", + "format" : "int32", + "description" : "Time added to the workflow interval to allow for rollback in case of failure." + }, + "concurrencyLimit" : { + "type" : "integer", + "format" : "int32", + "description" : "The maximum number of workflows that should be started simultaneiously." + }, + "normalDurationInSecs" : { + "type" : "integer", + "format" : "int32", + "description" : "Expected duration of a successful workflow execution." + }, + "policyId" : { + "type" : "string", + "description" : "The name of the schedule optimization policy used by the change management schedule optimizer." + }, + "changeManagementSchedules" : { + "type" : "array", + "description" : "The list of VNF workflows scheduled.", + "items" : { + "$ref" : "#/definitions/Change Management Schedule" + } + } + }, + "description" : "Scheduling critirea for a group of VNFs" + }, + "Change Management Schedule" : { + "type" : "object", + "properties" : { + "tmChangeId" : { + "type" : "string", + "description" : "TM Change Id" + }, + "tmStatus" : { + "type" : "string", + "description" : "TM ticket status", + "enum" : [ "", "Closed" ] + }, + "tmApprovalStatus" : { + "type" : "string", + "description" : "TM ticket approval status", + "enum" : [ "", "Approved" ] + }, + "finishTime" : { + "type" : "string", + "description" : "Anticipated time of completion based upon start time and duration" + }, + "startTime" : { + "type" : "string", + "description" : "Start time of this VNF workflow assigned by Scheduler based upon the group start time returned by the optimizer and concurrency." + }, + "status" : { + "type" : "string", + "description" : "Status of the VNF.", + "enum" : [ "See CMSStatusEnum" ] + }, + "vnfName" : { + "type" : "string", + "description" : "Name of the VNF." + }, + "dispatchTime" : { + "type" : "string", + "description" : "Actual time the VNF workflow was dispatched." + }, + "executionCompletedTime" : { + "type" : "string", + "description" : "Actual time the VNF workflow execution was completed as reported by MSO." + }, + "msoRequestId" : { + "type" : "string", + "description" : "MSO Request ID of the workflow returned at dispatch time." + }, + "msoStatus" : { + "type" : "string", + "description" : "Final MSO status.", + "enum" : [ "COMPLETED", "FAILED" ] + }, + "msoMessage" : { + "type" : "string", + "description" : "MSO final status message." + }, + "statusMessage" : { + "type" : "string", + "description" : "Scheduler status message." + }, + "msoTime" : { + "type" : "string", + "description" : "Time of last poll for MSO status." + } + }, + "description" : "VNF details for Change Management Schedule" + }, + "Change Management Scheduling Info" : { + "type" : "object", + "properties" : { + "normalDurationInSeconds" : { + "type" : "integer", + "format" : "int32", + "description" : "Expected duration (in seconds) of a successful execution of a single VNF change." + }, + "additionalDurationInSeconds" : { + "type" : "integer", + "format" : "int32", + "description" : "Additional duration (in seconds) to be added to support backout of an unsuccessful VNF change." + }, + "concurrencyLimit" : { + "type" : "integer", + "format" : "int32", + "description" : "Maximum number of VNF changes to schedule concurrently" + }, + "policyId" : { + "type" : "string", + "description" : "Name of schedule optimization policy used by the change management cmso optimizer to determine available time slot" + }, + "vnfDetails" : { + "type" : "array", + "description" : "Lists of the VNFs to be changed and the desired change windows", + "items" : { + "$ref" : "#/definitions/VNF Details" + } + } + }, + "description" : "Details of schedule being requested" + }, + "Change Window" : { + "type" : "object", + "properties" : { + "startTime" : { + "type" : "string", + "description" : "Earliest time that a set of changes may begin." + }, + "endTime" : { + "type" : "string", + "description" : "Latest time by which all changes must be completed" + } + }, + "description" : "Time window within which the scheduler optimizer can schedule the changes for the group of NVFs" + }, + "CmDetailsMessage" : { + "type" : "object", + "properties" : { + "vnfName" : { + "type" : "string", + "description" : "Name of the VNF." + }, + "status" : { + "type" : "string", + "description" : "Status of the VNF.", + "enum" : [ "See CMSStatusEnum" ] + }, + "tmChangeId" : { + "type" : "string", + "description" : "TM Change Id" + }, + "tmStatus" : { + "type" : "string", + "description" : "TM ticket status", + "enum" : [ "", "Closed" ] + }, + "tmApprovalStatus" : { + "type" : "string", + "description" : "TM ticket approval status", + "enum" : [ "", "Approved" ] + }, + "startTime" : { + "type" : "string", + "description" : "Start time of this VNF workflow assigned by Scheduler based upon the group start time returned by the optimizer and concurrency." + }, + "finishTime" : { + "type" : "string", + "description" : "Anticipated time of completion based upon start time and duration" + }, + "groupId" : { + "type" : "string", + "description" : "Name of the group of VNFs to be scheduled" + }, + "lastInstanceStartTime" : { + "type" : "string", + "description" : "The latest date/time by which a workflow is to be started." + }, + "policyId" : { + "type" : "string", + "description" : "Time of last poll for MSO status." + }, + "dispatchTime" : { + "type" : "string", + "description" : "Actual time the VNF workflow was dispatched." + }, + "executionCompletedTime" : { + "type" : "string", + "description" : "Actual time the VNF workflow execution was completed as reported by MSO." + }, + "msoRequestId" : { + "type" : "string", + "description" : "MSO Request ID of the workflow returned at dispatch time." + }, + "msoStatus" : { + "type" : "string", + "description" : "Final MSO status.", + "enum" : [ "COMPLETED", "FAILED" ] + }, + "msoMessage" : { + "type" : "string", + "description" : "MSO final status message." + }, + "statusMessage" : { + "type" : "string", + "description" : "Scheduler status message." + }, + "msoTime" : { + "type" : "string", + "description" : "Time of last poll for MSO status." + }, + "scheduleRequest" : { + "$ref" : "#/definitions/Schedule" + }, + "approvals" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Schedule Approval Request" + } + }, + "schedulesId" : { + "type" : "integer", + "format" : "int32" + } + } + }, + "Domain data" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string" + }, + "value" : { + "type" : "string" + } + }, + "description" : "Domain specific data represented as name/value pairs" + }, + "HealthCheckComponent" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string" + }, + "url" : { + "type" : "string" + }, + "status" : { + "type" : "string" + }, + "healthy" : { + "type" : "boolean" + } + } + }, + "HealthCheckMessage" : { + "type" : "object", + "properties" : { + "healthy" : { + "type" : "boolean" + }, + "buildInfo" : { + "type" : "string" + }, + "currentTime" : { + "type" : "string" + }, + "hostname" : { + "type" : "string" + }, + "components" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/HealthCheckComponent" + } + } + } + }, + "RequestError" : { + "type" : "object", + "properties" : { + "messageId" : { + "type" : "string" + }, + "text" : { + "type" : "string" + }, + "variables" : { + "type" : "array", + "items" : { + "type" : "string" + } + } + } + }, + "Response from schedule optimizer" : { + "type" : "object", + "properties" : { + "transactionId" : { + "type" : "string", + "description" : "Unique id of optimization request." + }, + "scheduleId" : { + "type" : "string", + "description" : "Schedule id for which the optimization request was executed." + }, + "requestState" : { + "type" : "string", + "description" : "State of the request as reported by the optimizer." + }, + "status" : { + "type" : "string", + "description" : "Status of the request." + }, + "description" : { + "type" : "string", + "description" : "Description of the request status." + }, + "schedule" : { + "type" : "array", + "description" : "List of schedules returned, one per group. Only 1 group supported at this time.", + "items" : { + "$ref" : "#/definitions/CMSchedule" + } + } + }, + "description" : "Asynchronous response to schedule oprimizer request." + }, + "Schedule" : { + "type" : "object", + "properties" : { + "createDateTime" : { + "type" : "string", + "description" : "Date/time schedule was created." + }, + "optimizerDateTime" : { + "type" : "string" + }, + "optimizerMessage" : { + "type" : "string" + }, + "optimizerStatus" : { + "type" : "string" + }, + "optimizerReturnDateTime" : { + "type" : "string" + }, + "optimizerTransactionId" : { + "type" : "string" + }, + "schedule" : { + "type" : "string" + }, + "scheduleName" : { + "type" : "string" + }, + "scheduleInfo" : { + "type" : "string" + }, + "status" : { + "type" : "string" + }, + "userId" : { + "type" : "string" + }, + "domain" : { + "type" : "string" + }, + "deleteDateTime" : { + "type" : "string" + }, + "domainData" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Domain data" + } + }, + "scheduleApprovals" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Schedule Approval" + } + }, + "groups" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Change Management Group" + } + } + } + }, + "Schedule Approval" : { + "type" : "object", + "properties" : { + "approvalDateTime" : { + "type" : "string", + "description" : "Date/time schedule time slot was accepted/rejected." + }, + "status" : { + "type" : "string", + "description" : "Approval status.", + "enum" : [ "Accepted", "Rejected" ] + }, + "userId" : { + "type" : "string", + "description" : "ATTUID of the user accepting/rejecting the time slot." + } + }, + "description" : "Details of a schedule approval/rejection." + }, + "Schedule Approval Request" : { + "type" : "object", + "properties" : { + "approvalUserId" : { + "type" : "string", + "description" : "ATTUID of the user accepting/rejecting the time slot." + }, + "approvalStatus" : { + "type" : "string", + "description" : "Approval status.", + "enum" : [ "Accepted", "Rejected" ] + }, + "approvalType" : { + "type" : "string", + "description" : "Type of approval.", + "enum" : [ "Tier 2" ] + }, + "approvalDateTime" : { + "type" : "string", + "format" : "date-time" + } + }, + "description" : "Request to accept or reject an optimized time slot." + }, + "VNF Details" : { + "type" : "object", + "properties" : { + "groupId" : { + "type" : "string", + "description" : "Name of the list of VNFs to be changed as a group" + }, + "node" : { + "type" : "array", + "description" : "Lists of the VNF names to be changed", + "items" : { + "type" : "string" + } + }, + "changeWindow" : { + "type" : "array", + "description" : "Lists of desired change windows that the optimizer can select from. (Only 1 change window supported at this time)", + "items" : { + "$ref" : "#/definitions/Change Window" + } + } + }, + "description" : "Details and scheduling criteria for the VNFs to be changed." + } + } +} \ No newline at end of file diff --git a/cmso-service/src/main/resources/system.properties b/cmso-service/src/main/resources/system.properties new file mode 100644 index 0000000..89954f2 --- /dev/null +++ b/cmso-service/src/main/resources/system.properties @@ -0,0 +1,48 @@ +#------------------------------------------------------------------------------- +# Copyright 2017-2018 AT&T Intellectual Property. +# Modifications Copyright 2018 IBM. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the ??License?); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------------- + +# If the environment property system_properties_path contains a path to a file, +# System properties created using the file. If the environment variable not present +# system.properties in the class path is used for system property creation + +com.att.eelf.logging.file=logback.xml + +# change as per logback.xml path +com.att.eelf.logging.path= +logging.config= + +spring.config.location=etc/config/ +spring.config.name=application,cmso,optimizer,ticketmgt + +# Default parameters during application startup. +info.build.artifact=@project.artifactId@ +info.build.name=@project.name@ +info.build.version=@project.version@ -- cgit 1.2.3-korg