Create test model

Issue-ID: SDC-4471
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I49d6721b9c60cf62ddcdc47beed70db08ba0a031
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index a2a41db..0db0050 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -52,6 +52,7 @@
         <it.docker.version>latest</it.docker.version>
         <it.ui.firefox.version>86.0</it.ui.firefox.version>
         <it.helm-validator.disabled>true</it.helm-validator.disabled>
+        <it.test-model.disabled>true</it.test-model.disabled>
         <it.helm-validator.version>1.3.1</it.helm-validator.version>
 
         <!-- parser-->
@@ -439,6 +440,72 @@
                             </resources>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>copy-normatives</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>
+                                integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/files/default
+                            </outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}</directory>
+                                    <includes>
+                                        <include>normatives.tar.gz</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-sdc-be-py</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>
+                                integration-tests-init/
+                            </outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>
+                                        ${project.parent.basedir}/catalog-be/src/main/resources/
+                                    </directory>
+                                    <includes>
+                                        <include>scripts/sdcBePy/**</include>
+                                        <inculde>scripts/setup.py</inculde>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-be-configuration</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <overwrite>true</overwrite>
+                            <outputDirectory>
+                                integration-tests-init/
+                            </outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>
+                                        ${project.parent.basedir}/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/
+                                    </directory>
+                                    <includes>
+                                        <include>BE-configuration.yaml.erb</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
@@ -500,6 +567,20 @@
                             <goal>run</goal>
                         </goals>
                     </execution>
+                    <execution>
+                        <id>add-test-model-to-config</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <target name="replace config" unless="${it.test-model.disabled}">
+                                <ant antfile="src/main/assembly/replace.xml">
+                                    <target name="BE-configuration"/>
+                                </ant>
+                            </target>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
@@ -521,6 +602,53 @@
                 </executions>
             </plugin>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>${mvn.assembly.version}</version>
+                <executions>
+                    <execution>
+                        <id>normatives</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>normatives</finalName>
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <descriptors>
+                                <descriptor>src/main/assembly/normatives.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-clean-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>clean.test.folder</id>
+                        <phase>clean</phase>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                        <configuration>
+                            <filesets>
+                                <fileset>
+                                    <directory>
+                                        integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/files/default
+                                    </directory>
+                                    <followSymlinks>false</followSymlinks>
+                                    <includes>
+                                        <include>normatives.tar.gz</include>
+                                    </includes>
+                                </fileset>
+                            </filesets>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <groupId>io.fabric8</groupId>
                 <artifactId>docker-maven-plugin</artifactId>
                 <dependencies>
@@ -727,6 +855,9 @@
                                 <hostname>sdc-BE</hostname>
                                 <volumes>
                                     <bind>
+                                        <volume>
+                                            ${project.basedir}/integration-tests-init/BE-configuration.yaml.erb:/app/jetty/chef-solo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
+                                        </volume>
                                         <volume>${it.chef.config}:/app/jetty/chef-solo/environments</volume>
                                         <volume>${it.shared.volume}:/app/jetty/logs</volume>
                                         <volume>
@@ -875,7 +1006,6 @@
                                 </network>
                             </run>
                         </image>
-
                         <image>
                             <name>selenium/standalone-firefox:${it.ui.firefox.version}</name>
                             <alias>firefox-standalone</alias>
@@ -946,10 +1076,60 @@
                                 </network>
                             </run>
                         </image>
+                        <image>
+                            <name>${docker.namespace}/sdc-integration-tests-init</name>
+                            <alias>integration-tests-init</alias>
+                            <build>
+                                <cleanup>try</cleanup>
+                                <dockerFileDir>${project.basedir}/integration-tests-init</dockerFileDir>
+                                <tags>
+                                    <tag>latest</tag>
+                                    <tag>
+                                        ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
+                                    </tag>
+                                    <tag>
+                                        ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
+                                    </tag>
+                                </tags>
+                            </build>
+                            <run>
+                                <skip>${it.test-model.disabled}</skip>
+                                <dependsOn>
+                                    <container>sdc-backend-init</container>
+                                </dependsOn>
+                                <env>
+                                    <ENVNAME>${it.env.name}</ENVNAME>
+                                </env>
+                                <hostname>integration-tests-init</hostname>
+                                <volumes>
+                                    <bind>
+                                        <volume>
+                                            ${it.chef.config}:/home/onap/chef-solo/environments
+                                        </volume>
+                                    </bind>
+                                </volumes>
+                                <wait>
+                                    <time>660000</time>
+                                    <log>Chef Client finished</log>
+                                </wait>
+                                <network>
+                                    <mode>custom</mode>
+                                    <name>sdc-network</name>
+                                    <alias>sdc-integration-tests-init</alias>
+                                </network>
+                            </run>
+                        </image>
                     </images>
                 </configuration>
                 <executions>
                     <execution>
+                        <id>docker-build-for-it</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                    <execution>
                         <id>docker-start-for-it</id>
                         <phase>pre-integration-test</phase>
                         <goals>
@@ -965,7 +1145,6 @@
                     </execution>
                 </executions>
             </plugin>
-
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
@@ -973,7 +1152,6 @@
                     <skip>true</skip>
                 </configuration>
             </plugin>
-
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-failsafe-plugin</artifactId>
@@ -1017,16 +1195,24 @@
     </build>
     <profiles>
         <profile>
+            <id>add-test-model</id>
+            <properties>
+                <it.test-model.disabled>false</it.test-model.disabled>
+            </properties>
+        </profile>
+        <profile>
             <id>all-for-integration-tests-only</id>
             <properties>
                 <surefire.skip.tests>true</surefire.skip.tests>
                 <skipTest>false</skipTest>
+                <it.test-model.disabled>false</it.test-model.disabled>
             </properties>
         </profile>
         <profile>
             <id>integration-tests-with-helm-validator</id>
             <properties>
                 <it.helm-validator.disabled>false</it.helm-validator.disabled>
+                <it.test-model.disabled>false</it.test-model.disabled>
             </properties>
             <build>
                 <plugins>