diff options
Diffstat (limited to 'mod/bpgenerator/common/src/main')
53 files changed, 3038 insertions, 0 deletions
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java new file mode 100644 index 0000000..fc546af --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java @@ -0,0 +1,57 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; + +/* + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Config: Object Mapper + */ + +@Configuration +public class ObjectMapperConfig { + + @Bean(name="objectMapper") + @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) + public ObjectMapper objectMapper(){ + return new ObjectMapper(); + } + + @Bean(name="yamlObjectMapper") + @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) + public ObjectMapper yamlObjectMapper(){ + return new ObjectMapper(new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)); + } + +}
\ No newline at end of file diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java new file mode 100644 index 0000000..69a71e5 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java @@ -0,0 +1,100 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.constants; + +/* + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Constants: Used in ONAP and DCAE Blueprints + */ + +public class Constants { + + public static final String _TOPIC = "_topic"; + public static final String _FEED = "_feed"; + public static final String DATAROUTER_VALUE = "data router"; + public static final String DATA_ROUTER = "data_router"; + public static final String MESSAGEROUTER_VALUE = "message router"; + public static final String MESSAGE_ROUTER = "message_router"; + public static final String TOSCA_DEF_VERSION = "cloudify_dsl_1_3"; + public static final String SERVICE_COMPONENT_NAME_OVERRIDE = "service_component_name_override"; + public static final String EMPTY = "''"; + public static final String INTEGER_TYPE = "integer"; + public static final String BOOLEAN_TYPE = "boolean"; + public static final String STRING_TYPE = "string"; + public static final String EMPTY_VALUE = ""; + public static final String DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT_USING_DMAAP = "dcae.nodes.ContainerizedServiceComponentUsingDmaap"; + public static final String MEMORY_LIMIT_128Mi = "128Mi"; + public static final String CPU_LIMIT_250m = "250m"; + public static final String CPU_LIMIT = "cpu_limit"; + public static final String MEMORY_LIMIT = "memory_limit"; + public static final String CPU_REQUEST = "cpu_request"; + public static final String MEMORY_REQUEST = "memory_request"; + + public static final String CLOUDIFY_INTERFACES_LEFECYCLE = "cloudify.interfaces.lifecycle"; + public static final String DCAE = "dcae"; + public static final String DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT = "dcae.nodes.ContainerizedServiceComponent"; + public static final String ONAP_NAME_DCAE = "DCAE"; + public static final String POLICIES_POLICYNAME_DCAECONFIG = "DCAE.Config_"; + + public static final String DB_RELATIONSHIP_TYPE = "cloudify.relationships.depends_on"; + public static final String NAME_POSTFIX = "_database_name"; + public static final String PGAAS_NODE_NAME_POSTFIX = "_pgaasdb"; + public static final String PGAAS_NODE_TYPE = "dcae.nodes.pgaas.database"; + public static final String POLICY_NODE_TYPE = "clamp.nodes.policy"; + public static final String POLICY_RELATIONSHIP_TYPE = "cloudify.relationships.depends_on"; + public static final String WRITER_FQDN_POSTFIX = "_database_writerfqdn"; + public static final boolean USE_EXISTING = true; + public static final String ONAP_INPUT_CPU_LIMIT = "dcae-ves-collector_cpu_limit"; + public static final String ONAP_NODETEMPLATES = "dcae-ves-collector"; + public static final String ONAP_NODETEMPLATES_TYPE = "dcae.nodes.ContainerizedServiceComponent"; + public static final String ONAP_DEFAULT250m = "\"250m\""; + public static final String ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT = "\"\""; + public static final String DMAAP_NODETEMPLATES_TYPE = "dcae.nodes.ContainerizedServiceComponentUsingDmaap"; + public static final String USE_EXTERNAL_TLS_FIELD = "use_external_tls"; + public static final String DEFAULT_CA = "RA"; + public static final Object DEFAULT_CERT_TYPE = "P12"; + public static final String INPUT_PREFIX = "external_cert_"; + public static final String EXTERNAL_CERT_DIRECTORY_FIELD = "external_cert_directory"; + public static final String CA_NAME_FIELD = "ca_name"; + public static final String CERT_TYPE_FIELD = "cert_type"; + public static final String EXTERNAL_CERTIFICATE_PARAMETERS_FIELD = "external_certificate_parameters"; + public static final String CERT_DIRECTORY_FIELD = "cert_directory"; + public static final String COMMON_NAME_FIELD = "common_name"; + public static final String SANS_FIELD = "sans"; + public static final String DEFAULT_COMMON_NAME = "sample.onap.org"; + public static final String DEFAULT_SANS = "sample.onap.org:component.sample.onap.org"; + public static final String FEED = "dcaegen2.nodes.Feed"; + public static final String TOPIC = "dcaegen2.nodes.Topic"; + public static final String PUBLISH_EVENTS = "dcaegen2.relationships.publish_events"; + public static final String PUBLISH_FILES = "dcaegen2.relationships.publish_files"; + public static final String SUBSCRIBE_TO_EVENTS = "dcaegen2.relationships.subscribe_to_events"; + public static final String SUBSCRIBE_TO_FILES = "dcaegen2.relationships.subscribe_to_files"; + public static final String TOSCA_DATATYPES_ROOT = "tosca.datatypes.Root"; + public static final String TOSCA_NODES_ROOT = "tosca.nodes.Root"; + public static final String TOSCA_SIMPLE_YAML = "tosca_simple_yaml_1_0_0"; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java new file mode 100644 index 0000000..f6ed5c7 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java @@ -0,0 +1,43 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.exception; + +/* + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Exception: For Blueprint + */ + +public class BlueprintException extends RuntimeException{ + + public BlueprintException(String errorMessage) { + super(errorMessage); + } + + public BlueprintException(String errorMessage, Throwable err) { + super(errorMessage, err); + } +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java new file mode 100644 index 0000000..ff0270e --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java @@ -0,0 +1,43 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.exception; + +/* + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Exception: For ComponentSpec + */ + +public class ComponentSpecException extends RuntimeException{ + + public ComponentSpecException(String errorMessage) { + super(errorMessage); + } + + public ComponentSpecException(String errorMessage, Throwable err) { + super(errorMessage, err); + } +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java new file mode 100644 index 0000000..423da79 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java @@ -0,0 +1,38 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.exception; + +/* + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Exception: For Databases Not Found + */ + +public class DatabasesNotFoundException extends RuntimeException { + + public DatabasesNotFoundException(String message) { super(message);} + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java new file mode 100644 index 0000000..aa81ede --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java @@ -0,0 +1,43 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.exception; + +/* + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Exception: For Fixes + */ + +public class FixesException extends RuntimeException{ + + public FixesException(String errorMessage) { + super(errorMessage); + } + + public FixesException(String errorMessage, Throwable err) { + super(errorMessage, err); + } +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java new file mode 100644 index 0000000..a72a00d --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java @@ -0,0 +1,55 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.base; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Base Model: For Blueprint + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Blueprint { + + private String tosca_definitions_version; + + private String description; + + private List<String> imports; + + private Map<String, LinkedHashMap<String, Object>> inputs; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java new file mode 100644 index 0000000..c3df820 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java @@ -0,0 +1,46 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.base; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Base Model: For Node + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Node { + + private String type; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java new file mode 100644 index 0000000..3a18b70 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java @@ -0,0 +1,64 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + +import org.onap.blueprintgenerator.model.componentspec.common.Calls; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.Map; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For App Config + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Appconfig { + + private Calls[] services_calls; + + private Map<String, Dmaap> streams_publishes; + + private Map<String, Dmaap> streams_subscribes; + + private Map<String, Object> params; + + @JsonAnyGetter //The Map is persisted as flattened properties of the target POJO. + public Map<String, Object> getParams() { + return params; + } + + //Used in ONAP + private Calls[] service_calls; + +} + diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java new file mode 100644 index 0000000..d3b3c01 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java @@ -0,0 +1,48 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.List; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Concat + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Concat { + + private List<Object> concat; + +} + diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java new file mode 100644 index 0000000..49e029f --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java @@ -0,0 +1,47 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + + +import org.onap.blueprintgenerator.constants.Constants; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Data Router + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class DataRouter extends Dmaap { + + private String type = Constants.DATA_ROUTER; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java new file mode 100644 index 0000000..de3b31e --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java @@ -0,0 +1,53 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Dmaap + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Dmaap { + + private Object dmaap_info; + + //Below properties are used in ONAP + private String type; + + private GetInput pass; + + private GetInput user; + +}
\ No newline at end of file diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java new file mode 100644 index 0000000..cc87014 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java @@ -0,0 +1,54 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Get Input + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@AllArgsConstructor +@NoArgsConstructor +public class GetInput { + + //private Object get_input; + + @JsonProperty("get_input") + private Object bpInputName; + +}
\ No newline at end of file diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java new file mode 100644 index 0000000..0514d20 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java @@ -0,0 +1,47 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.List; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Get Property + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class GetProperty { + + private List<String> get_property; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java new file mode 100644 index 0000000..eacf20e --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java @@ -0,0 +1,45 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.List; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Imports + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class Imports { + + private List<String> imports; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java new file mode 100644 index 0000000..781ce2e --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java @@ -0,0 +1,72 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.List; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Input + */ + +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Input { + + private String componentSpecPath; + + private String bluePrintName; + + private String outputPath; + + private String policyPath; + + private String bpType; + + private int numPolicies; + + private int numPolicy; + + private String comment; + + private boolean useExisting; + + private List<String> imports; + + private boolean useDti; + + //Used in ONAP + private String serviceNameOverride; + + private String importPath; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java new file mode 100644 index 0000000..7d96785 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java @@ -0,0 +1,50 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.common; + +import org.onap.blueprintgenerator.constants.Constants; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Common Model: For Message Router + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class MessageRouter extends Dmaap { + + private String type = Constants.MESSAGE_ROUTER; + + private Object aaf_password; + + private Object aaf_username; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java new file mode 100644 index 0000000..9c37163 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java @@ -0,0 +1,74 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.base; + + +import org.onap.blueprintgenerator.model.componentspec.common.HealthCheck; +import org.onap.blueprintgenerator.model.componentspec.common.Policy; +import org.onap.blueprintgenerator.model.componentspec.common.Reconfigs; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Auxilary + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Auxilary { + + private HealthCheck healthcheck; + + private HealthCheck livehealthcheck; + + private Policy policy; + + private Reconfigs reconfigs; + + private List<LinkedHashMap<String, String>> env; + + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Map<String, String> databases; + +/* @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Affinity affinity;*/ + + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Object hpa_config; + + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java new file mode 100644 index 0000000..e3583e7 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java @@ -0,0 +1,55 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.base; + +import org.onap.blueprintgenerator.model.componentspec.common.Artifacts; +import org.onap.blueprintgenerator.model.componentspec.common.Parameters; +import org.onap.blueprintgenerator.model.componentspec.common.Self; +import org.onap.blueprintgenerator.model.componentspec.common.Streams; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For ComponentSpec + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ComponentSpec { + + private Self self; + + private Streams streams; + + private Parameters[] parameters; + + private Artifacts[] artifacts; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java new file mode 100644 index 0000000..0ae1c1a --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java @@ -0,0 +1,49 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Artifacts + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Artifacts { + + private String type; + + private String uri; +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java new file mode 100644 index 0000000..752040d --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java @@ -0,0 +1,50 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Calls + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Calls { + + private String config_key; + + private RequestResponse request; + + private RequestResponse response; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java new file mode 100644 index 0000000..cb248b9 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java @@ -0,0 +1,60 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Constraints + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Constraints { + + private Object equal; + + private int greater_than; + + private int greater_or_equal; + + private int less_than; + + private int less_or_equal; + + private Object[] valid_values; + + private int length; + + private int min_length; + + private int max_length; +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java new file mode 100644 index 0000000..3157338 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java @@ -0,0 +1,46 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Container + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@EqualsAndHashCode +public class Container { + + private String bind; + + private String mode; +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java new file mode 100644 index 0000000..d0355ea --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java @@ -0,0 +1,56 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Entry Schema + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class EntrySchema { + + private String name; + + private String description; + + private String type; + + private String value; + + private EntrySchema[] entry_schema; + + private boolean required; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java new file mode 100644 index 0000000..01c1497 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java @@ -0,0 +1,58 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For HealthCheck + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class HealthCheck { + + private String interval; + + private String timeout; + + private String script; + + private String type; + + private String endpoint; + + private String initialDelaySeconds; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java new file mode 100644 index 0000000..6a9d812 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java @@ -0,0 +1,47 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Host + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@EqualsAndHashCode +public class Host { + + private String path; + + private String mode; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java new file mode 100644 index 0000000..9c1931c --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java @@ -0,0 +1,69 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Parameters + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Parameters { + + private String name; + + private Object value; + + private String description; + + private boolean sourced_at_deployment; + + private boolean designer_editable; + + private boolean policy_editable; + + private boolean required; + + private String type; + + private String policy_group; + + private PolicySchema[] policy_schema; + + private EntrySchema[] entry_schema; + + private Constraints[] constraints; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java new file mode 100644 index 0000000..ea419f3 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java @@ -0,0 +1,47 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Policy + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@EqualsAndHashCode +public class Policy { + + private String trigger_type; + + private String script_path; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java new file mode 100644 index 0000000..2d17086 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java @@ -0,0 +1,57 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Policy Schema + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class PolicySchema { + + private String name; + + private String description; + + private String type; + + private String value; + + private EntrySchema[] entry_schema; + + private boolean required; + + private Constraints[] constraints; + + } diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java new file mode 100644 index 0000000..5301cbe --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java @@ -0,0 +1,52 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Provides + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Provides { + + private String route; + + private RequestResponse request; + + private RequestResponse response; + + //Used in ONAP + private String verb; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java new file mode 100644 index 0000000..cd8230e --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java @@ -0,0 +1,56 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Publishes + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Publishes { + + private String config_key; + + private String format; + + private String type; + + private String version; + + //Used in ONAP + private String route; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java new file mode 100644 index 0000000..96b0fb3 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java @@ -0,0 +1,54 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Reconfigs + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Reconfigs { + + private String dti; + + private String app_reconfig; + + private String policy; + + private String streams; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java new file mode 100644 index 0000000..0376de1 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java @@ -0,0 +1,48 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Request Response + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class RequestResponse { + + private String format; + + private String version; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java new file mode 100644 index 0000000..b657b16 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java @@ -0,0 +1,53 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Self + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Self { + + private String component_type; + + private String description; + + private String name; + + private String version; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java new file mode 100644 index 0000000..3791e32 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java @@ -0,0 +1,50 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Streams + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Streams { + + private Publishes[] publishes; + + private Subscribes[] subscribes; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java new file mode 100644 index 0000000..668a517 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java @@ -0,0 +1,56 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Subscribes + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Subscribes { + + private String config_key; + + private String format; + + private String route; + + private String type; + + private String version; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java new file mode 100644 index 0000000..6f12b47 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java @@ -0,0 +1,54 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.componentspec.common; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAP and DCAE Blueprint Applications + * Component Spec Model: For Volumes + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Volumes { + + private Container container; + + private Host host; + + private String type; + + private String name; + +}
\ No newline at end of file diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java new file mode 100644 index 0000000..35d210c --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java @@ -0,0 +1,52 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + +import org.onap.blueprintgenerator.constants.Constants; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policies + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class Policies { + + private String configAttributes; + + private String configName; + + private String onapName = Constants.ONAP_NAME_DCAE; + + private String policyName = Constants.POLICIES_POLICYNAME_DCAECONFIG; + + private boolean unique = false; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java new file mode 100644 index 0000000..7b951cc --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java @@ -0,0 +1,44 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + +import org.onap.blueprintgenerator.model.base.Node; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policies Node + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class PoliciesNode extends Node { + + private PoliciesProperties properties; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java new file mode 100644 index 0000000..11844bf --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java @@ -0,0 +1,43 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policies Properties + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class PoliciesProperties { + + private PolicyFilter policy_filter; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java new file mode 100644 index 0000000..b5f098c --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java @@ -0,0 +1,44 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policy + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class Policy { + + private String policy_id; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java new file mode 100644 index 0000000..e49e6c3 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java @@ -0,0 +1,52 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + +import org.onap.blueprintgenerator.constants.Constants; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policy Filters + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class PolicyFilter { + + private String configAttributes = Constants.EMPTY; + + private String configName = Constants.EMPTY; + + private String onapName = Constants.ONAP_NAME_DCAE; + + private Object policyName; + + private boolean unique = false; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java new file mode 100644 index 0000000..ca13cd7 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java @@ -0,0 +1,45 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policy Input + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class PolicyInput { + + private Policies[] policies; + + private Policy[] policy; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java new file mode 100644 index 0000000..f5ebf05 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java @@ -0,0 +1,44 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + +import org.onap.blueprintgenerator.model.base.Node; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policy Node + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class PolicyNode extends Node { + + private PolicyProperties properties; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java new file mode 100644 index 0000000..8ec4a32 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java @@ -0,0 +1,44 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.policy; + +import org.onap.blueprintgenerator.model.common.GetInput; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Model: To Get Policy Properties + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class PolicyProperties { + + private GetInput policy_id; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java new file mode 100644 index 0000000..47994c3 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java @@ -0,0 +1,45 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.model.translate; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.util.List; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Translate Model: To Get Property + */ + +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +public class GetProperty { + + private List<String> get_property; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java new file mode 100644 index 0000000..1f6b4f8 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java @@ -0,0 +1,118 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.service.base; + + +import org.onap.blueprintgenerator.constants.Constants; +import org.springframework.stereotype.Service; + +import java.util.LinkedHashMap; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Service: For Common Functions used across + */ + +@Service +public class BlueprintHelperService { + + + public LinkedHashMap<String, Object> createInputValue(String type, String description, Object defaultValue) { + LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>(); + inputMap.put("type", type); + inputMap.put("description", description); + inputMap.put("default", defaultValue); + return inputMap; + } + + public LinkedHashMap<String, Object> createInputValue(String type, String description) { + LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>(); + inputMap.put("type", type); + inputMap.put("description", description); + return inputMap; + } + + public LinkedHashMap<String, Object> createInputValue(String type, Object defaultValue) { + LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>(); + inputMap.put("type", type); + inputMap.put("default", defaultValue); + return inputMap; + } + + public LinkedHashMap<String, Object> createIntegerInput(String description, Object defaultValue){ + return createInputValue(Constants.INTEGER_TYPE, description, defaultValue); + } + + public LinkedHashMap<String, Object> createIntegerInput(String description){ + return createInputValue(Constants.INTEGER_TYPE, description); + } + + public LinkedHashMap<String, Object> createIntegerInput(Object defaultValue){ + return createInputValue(Constants.INTEGER_TYPE, defaultValue); + } + + public LinkedHashMap<String, Object> createBooleanInput(String description, Object defaultValue){ + return createInputValue(Constants.BOOLEAN_TYPE, description, defaultValue); + } + + public LinkedHashMap<String, Object> createBooleanInput(String description){ + return createInputValue(Constants.BOOLEAN_TYPE, description); + } + + public LinkedHashMap<String, Object> createBooleanInput(Object defaultValue){ + return createInputValue(Constants.BOOLEAN_TYPE, defaultValue); + } + + public LinkedHashMap<String, Object> createStringInput(String description, Object defaultValue){ + return createInputValue(Constants.STRING_TYPE, description, defaultValue); + } + +/* public LinkedHashMap<String, Object> createStringInput(String description){ + return createInputValue(Constants.STRING_TYPE, description); + }*/ + + public LinkedHashMap<String, Object> createStringInput(Object defaultValue){ + return createInputValue(Constants.STRING_TYPE, defaultValue); + } + + public String joinUnderscore(String firstValue, String secondValue){ + return firstValue + "_" + secondValue; + } + + public boolean isDataRouterType(String type) { + return type.equals(Constants.DATA_ROUTER) || type.equals(Constants.DATAROUTER_VALUE); + } + + public boolean isMessageRouterType(String type) { + return type.equals(Constants.MESSAGE_ROUTER) || type.equals(Constants.MESSAGEROUTER_VALUE); + } + + public String getNamePrefix(String name) { + return name.isEmpty() ? "" : name + "_"; + } + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java new file mode 100644 index 0000000..83c43cf --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java @@ -0,0 +1,157 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.service.base; + +import org.onap.blueprintgenerator.model.base.Blueprint; +import org.onap.blueprintgenerator.model.common.Input; +import org.onap.blueprintgenerator.model.componentspec.base.ComponentSpec; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + + +import java.io.File; +import java.io.IOException; +import java.io.FileWriter; +import java.io.BufferedWriter; +import java.io.PrintWriter; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.regex.Pattern; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Service: For Adding Quotes and Converting Blueprint to Yaml/String + */ + +@Service +public abstract class BlueprintService { + + @Autowired + protected FixesService fixesService; + + @Qualifier("objectMapper") + @Autowired + protected ObjectMapper objectMapper; + + @Qualifier("yamlObjectMapper") + @Autowired + protected ObjectMapper yamlObjectMapper; + + public void blueprintToYaml(ComponentSpec cs, Blueprint blueprint, Input input) { + String bluePrintName = input.getBluePrintName(); + String outputPath = input.getOutputPath(); + String comment = "# " + input.getComment() + '\n'; + + try { + File outputFile; + String name = StringUtils.isEmpty(bluePrintName) ? cs.getSelf().getName() : bluePrintName; + if(name.contains(".")) { + name = name.replaceAll(Pattern.quote("."), "_"); + } + if(name.contains(" ")) { + name = name.replaceAll(" ", ""); + } + String file = name + ".yaml"; + outputFile = new File(outputPath, file); + outputFile.getParentFile().mkdirs(); + try { + outputFile.createNewFile(); + } catch (IOException e) { + throw new RuntimeException(e); + } + + String version = "#blueprint_version: " + cs.getSelf().getVersion() + '\n'; + String description = "#description: " + cs.getSelf().getDescription() + '\n'; + + BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile, false)); + writer.write(description); + writer.write(version); + + if(input.getBpType().equals("dti") || input.getBpType().equals("m") || input.getBpType().equals("k")) + writer.write(comment); + + writer.close(); + + PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile, true))); + yamlObjectMapper.writeValue(out, blueprint); + out.close(); + + if(input.getBpType().equals("dti") || input.getBpType().equals("m") || input.getBpType().equals("k")) + fixesService.fixDcaeSingleQuotes(outputFile); + else + fixesService.fixOnapSingleQuotes(outputFile); + + //new Yaml().load(new FileInputStream(outputFile)); + + System.out.println("Blueprint is created with valid YAML Format"); + } catch (Exception ex) { + throw new RuntimeException("Unable to generate YAML file from Blueprint or the generated YAML is not valid", ex); + } + } + + // Used for DCAE + public Map<String, LinkedHashMap<String, Object>> addQuotes(Map<String, LinkedHashMap<String, Object>> inputs) { + + inputs.forEach((key,value) -> { + if(value.get("type") != null){ + if (value.get("type").equals("string") && value.get("default") != null && !key.contains("policies")){ + value.replace("default", "'" + value.get("default").toString() + "'"); + } else if (value.get("type").equals("map") || value.get("type").equals("list")) { + // Commented the Code as we need to read the object as is for Map and List. If the List object is to be converted to string uncomment the below code. + /* if(inputs.get(s).get("type").equals("list")) { + String temp = inputs.get(s).get("default").toString(); + inputs.get(s).replace("default", temp); + }*/ + inputs.get(key).remove("type"); + } + } + }); + + return inputs; + } + + public String blueprintToString(ComponentSpec componentSpec, Blueprint blueprint, Input input) { + String ret = ""; + try { + ret = yamlObjectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(blueprint); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if(input.getBpType().equals("dti") || input.getBpType().equals("m") || input.getBpType().equals("k")){ + ret = "# " + componentSpec.getSelf().getDescription() + "\n" + "# " + componentSpec.getSelf().getVersion() + "\n" + "# " + input.getComment() + "\n" + ret; + ret = fixesService.fixStringQuotes(ret); + }else + ret = fixesService.applyFixes(ret); + return ret; + } + + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java new file mode 100644 index 0000000..d848cac --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java @@ -0,0 +1,170 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.blueprintgenerator.service.base; + +import org.onap.blueprintgenerator.exception.FixesException; +import org.springframework.stereotype.Service; + + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.io.FileReader; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Service: For Blueprint Quotes Fixes + */ + +@Service +public class FixesService { + + public void fixDcaeSingleQuotes(File file) { + List<String> lines = new ArrayList<>(); + try { + FileReader fr = new FileReader(file); + BufferedReader br = new BufferedReader(fr); + for (String line = br.readLine(); line != null; line = br.readLine()){ + if(line.contains("'")) { + line = line.replaceAll("'\\{", "{"); + line = line.replaceAll("}'", "}"); + line = line.replaceAll("'\\[", "["); + line = line.replaceAll("]'", "]"); + line = line.replaceAll("'''''", "'"); + line = line.replaceAll("'''", "'"); + line = line.replaceAll("'''", ""); + line = line.replaceAll("''\\{", "'{"); + line = line.replaceAll("}''", "}'"); + line = line.replaceAll("''\\[", "'["); + line = line.replaceAll("]''", "]'"); + line = line.replaceAll("\"''", "'"); + line = line.replaceAll("''\"", "'"); + } + if(line.contains("get_input") || line.contains("get_secret") || line.contains("envs")) + line = line.replaceAll("'", ""); + + lines.add(line); + } + + fr.close(); + br.close(); + + FileWriter fw = new FileWriter(file); + PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true))); + for(String s: lines) { + out.println(); + out.write(s); + out.flush(); + } + out.close(); + fw.close(); + } catch (Exception e) { + throw new FixesException("Unable to Fix Single Quotes in Final DCAE Blueprint", e); + } + } + + public String fixStringQuotes(String string) { + String sLines[] = string.split("\n"); + String ret = ""; + for(String line: sLines) { + if(line.contains("get_input") || line.contains("get_secret") || ((line.contains("concat") || line.contains("default: ") || line.contains("description") || line.contains("dmaap") || line.contains(".\"'")) && line.contains("'"))) + line = line.replaceAll("'", ""); + + if(line.contains("'")) { + line = line.replaceAll("'\\{", "{"); + line = line.replaceAll("}'", "}"); + line = line.replaceAll("'\\[", "["); + line = line.replaceAll("]'", "]"); + line = line.replaceAll("'''''", "'"); + line = line.replaceAll("'''", "'"); + line = line.replaceAll("'''", ""); + line = line.replaceAll("''\\{", "'{"); + line = line.replaceAll("}''", "}'"); + line = line.replaceAll("''\\[", "'["); + line = line.replaceAll("]''", "]'"); + line = line.replaceAll("\"''", "'"); + line = line.replaceAll("''\"", "'"); + } + ret = ret + "\n" + line; + } + return ret; + } + + public void fixOnapSingleQuotes(File file) { + List<String> lines = new ArrayList<>(); + try { + FileReader fr = new FileReader(file); + BufferedReader br = new BufferedReader(fr); + for (String line = br.readLine(); line != null; line = br.readLine()){ + if(line.contains("'")) { + line = line.replace("'", ""); + } + if(line.contains("\"\"") && (line.contains("m") || line.contains("M"))) { + line = line.replaceAll("\"\"", "\""); + } + lines.add(line); + + } + fr.close(); + br.close(); + FileWriter fw = new FileWriter(file); + PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true))); + for(String s: lines) { + out.println(); + out.write(s); + out.flush(); + } + + out.close(); + fw.close(); + + } catch (Exception e) { + throw new FixesException("Unable to Fix Single Quotes in final ONAP Blueprint", e); + } + } + + private String ensureNoSingleQuotes(String line) { + if ((line.contains("concat") || line.contains("default: ") || line.contains("description") || line.contains("dmaap") || line.contains(".\"'")) && line.contains("'")) + return line.replace("'", ""); + else + return line; + } + + public String applyFixes(String bp) { + List<String> lines = new ArrayList<>(); + String[] linesPre = bp.split("\n"); + for (String line : linesPre) { + lines.add(ensureNoSingleQuotes(line)); + } + return String.join("\n", lines); + } + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java new file mode 100644 index 0000000..e848437 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java @@ -0,0 +1,43 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.policycreate.exception; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Exception: For Policy Create + */ + +public class PolicyCreateException extends RuntimeException{ + + public PolicyCreateException(String errorMessage) { + super(errorMessage); + } + + public PolicyCreateException(String errorMessage, Throwable err) { + super(errorMessage, err); + } +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java new file mode 100644 index 0000000..3d8c1a7 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java @@ -0,0 +1,49 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.policycreate.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import lombok.Data; + +import java.util.Map; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Create Model: For Policy Model + */ + +@Data +@JsonInclude(value=Include.NON_NULL) +public class PolicyModel { + + private String tosca_definition_version; + private Map<String, PolicyModelNode> node_types; + private Map<String, PolicyModelNode> data_types; + +} + diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java new file mode 100644 index 0000000..eac29b6 --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java @@ -0,0 +1,47 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.policycreate.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import lombok.Data; + +import java.util.Map; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Create Model: For Policy Model Node + */ + +@Data +@JsonInclude(value=Include.NON_NULL) +public class PolicyModelNode { + + private String derived_from; + private Map<String, PolicyProperties> properties; + +} diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java new file mode 100644 index 0000000..f12e76d --- /dev/null +++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java @@ -0,0 +1,45 @@ +/* + * + * * ============LICENSE_START======================================================= + * * org.onap.dcae + * * ================================================================================ + * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * ================================================================================ + * * 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. + * * ============LICENSE_END========================================================= + * + * + */ + +package org.onap.policycreate.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 + * Application: DCAE/ONAP - Blueprint Generator + * Common Module: Used by both ONAp and DCAE Blueprint Applications + * Policy Create Model: For Policy Properties + */ + +@Data +@JsonInclude(value=Include.NON_NULL) +public class PolicyProperties { + + private String type; + private Object entry_schema; + +}
\ No newline at end of file |