Merge "updated ServiceInstance POJO"
authorMarcus Williams <marcus.williams@intel.com>
Wed, 22 Aug 2018 16:46:17 +0000 (16:46 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 22 Aug 2018 16:46:17 +0000 (16:46 +0000)
14 files changed:
adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
adapters/mso-openstack-adapters/src/main/resources/application.yaml
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json
bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
docs/Install_Configure_SO.rst
docs/installconfigure/Configure_git_and_gerrit.rst [new file with mode: 0644]
docs/installconfigure/Install_Docker.rst [new file with mode: 0644]
docs/installconfigure/Workspace_and_Development_Tools.rst [new file with mode: 0644]
packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml

index fd2ec17..ed64abd 100644 (file)
@@ -13,6 +13,8 @@ import org.onap.so.db.catalog.beans.CloudSite;
 import org.onap.so.db.catalog.beans.CloudifyManager;
 import org.onap.so.logger.MsoLogger;
 
+import java.io.FileInputStream;
+import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -33,10 +35,31 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
     @Override
     public void migrate(Connection connection) throws Exception {
         LOGGER.debug("Starting migration for CloudConfig");
-        CloudConfig cloudConfig = loadCloudConfig();
-        if(cloudConfig == null){
-            LOGGER.debug("No CloudConfig defined in :"+getApplicationYamlName()+" exiting.");
-        }else{
+        
+        CloudConfig cloudConfig = null;
+
+        // Try the override file
+        String configLocation = System.getProperty("spring.config.location");
+        if (configLocation != null) {
+            try (InputStream stream = new FileInputStream(configLocation)) {
+                cloudConfig = loadCloudConfig(stream);
+            }
+        }
+        
+        if (cloudConfig == null) {
+               LOGGER.debug("No CloudConfig defined in " + configLocation);
+
+               // Try the application.yaml file
+            try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) {
+                cloudConfig = loadCloudConfig(stream);
+            }
+
+            if (cloudConfig == null) {
+               LOGGER.debug("No CloudConfig defined in " + getApplicationYamlName());
+            }
+        }
+        if(cloudConfig != null){
             migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
             migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
             migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
@@ -51,13 +74,14 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
         this.cloudConfig = cloudConfig;
     }
 
-    private CloudConfig loadCloudConfig() throws Exception {
+    private CloudConfig loadCloudConfig(InputStream stream) throws Exception {
         ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-        R__CloudConfigMigration cloudConfigMigration = mapper.readValue(R__CloudConfigMigration.class
-                .getResourceAsStream(getApplicationYamlName()), R__CloudConfigMigration.class);
+        R__CloudConfigMigration cloudConfigMigration =
+                       mapper.readValue(stream, R__CloudConfigMigration.class);
         CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
+
         if(cloudConfig != null){
-            cloudConfig.populateId();
+               cloudConfig.populateId();
         }
 
         return cloudConfig;
@@ -72,8 +96,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
         LOGGER.debug("Starting migration for CloudConfig-->IdentityService");
         String insert = "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`) " +
                 "VALUES (?,?,?,?,?,?,?,?,?,?);";
-        PreparedStatement ps = connection.prepareStatement(insert);
-        try (Statement stmt = connection.createStatement()) {
+
+        try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) {
             for (CloudIdentity cloudIdentity : entities) {
                 try (ResultSet rows = stmt.executeQuery("Select count(1) from identity_services where id='" + cloudIdentity.getId() + "'")) {
                     int count = 0;
@@ -102,8 +126,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
         LOGGER.debug("Starting migration for CloudConfig-->CloudSite");
         String insert = "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) " +
                 "VALUES (?,?,?,?,?,?,?,?,?);";
-        PreparedStatement ps = connection.prepareStatement(insert);
-        try (Statement stmt = connection.createStatement()) {
+
+        try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) {
             for (CloudSite cloudSite : entities) {
                 try (ResultSet rows = stmt.executeQuery("Select count(1) from cloud_sites where id='" + cloudSite.getId() + "'")) {
                     int count = 0;
@@ -130,8 +154,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
     private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws Exception {
         String insert = "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)" +
                 " VALUES (?,?,?,?,?,?);";
-        PreparedStatement ps = connection.prepareStatement(insert);
-        try (Statement stmt = connection.createStatement()) {
+
+        try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) {
             for (CloudifyManager cloudifyManager : entities) {
                 try (ResultSet rows = stmt.executeQuery("Select count(1) from cloudify_managers where id='" + cloudifyManager.getId() + "'")) {
                     int count = 0;
index 4a4c83e..4b2cf8e 100644 (file)
@@ -41,4 +41,6 @@ management:
 
 flyway:
   outOfOrder: true
-  ignoreMissingMigrations: true
\ No newline at end of file
+  ignoreMissingMigrations: true
+  baseline-on-migrate: true
+  validate-on-migrate: false
index aa865f0..0b71245 100644 (file)
@@ -96,6 +96,7 @@ public class VnfAdapterImpl {
                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
                     }
                 }
+                execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
             }
                } catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
index 1d87b70..515f04b 100644 (file)
@@ -178,6 +178,9 @@ public class VnfAdapterVfModuleObjectMapper {
                if (requestContext.getUserParams() != null) {
                        paramsMap.putAll(requestContext.getUserParams());
                }
+               if (vfModule.getCloudParams() != null) {
+                       paramsMap.putAll(vfModule.getCloudParams());
+               }
                return paramsMap;
        }
        
index 99256fd..af670d1 100644 (file)
@@ -128,6 +128,15 @@ public class VfModuleTopologyOperationRequestMapper {
                        }
                }
                
+               if (vfModule.getCloudParams() != null) {
+                       for (Map.Entry<String, String> entry : vfModule.getCloudParams().entrySet()) {
+                               GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+                               paramItem.setName(entry.getKey());
+                               paramItem.setValue(entry.getValue());
+                               vfModuleInputParameters.addParamItem(paramItem);
+                       }
+               }
+               
                if (volumeGroup != null) {
                        GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
                        paramItem.setName("volume-group-id");
index 1bb59e7..0c9e281 100644 (file)
@@ -103,6 +103,9 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
                modelInfoVfModule.setModelUUID("vfModuleModelUuid");
                modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
                vfModule.setModelInfoVfModule(modelInfoVfModule);
+               HashMap<String, String> cloudParams = new HashMap<String, String>();
+               cloudParams.put("key3", "value3");
+               vfModule.setCloudParams(cloudParams);
 
                CloudRegion cloudRegion = new CloudRegion();
                cloudRegion.setLcpCloudRegionId("cloudRegionId");
index 369a732..b3999a7 100644 (file)
@@ -100,6 +100,9 @@ public class VfModuleTopologyOperationRequestMapperTest {
                modelInfoVfModule.setModelUUID("vfModuleModelUuid");
                modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
                vfModule.setModelInfoVfModule(modelInfoVfModule);
+               HashMap<String, String> cloudParams = new HashMap<String, String>();
+               userParams.put("key2", "value2");
+               vfModule.setCloudParams(cloudParams);
 
                VolumeGroup volumeGroup = new VolumeGroup();
                volumeGroup.setVolumeGroupId("volumeGroupId");
index 0db327e..0132068 100644 (file)
@@ -39,6 +39,7 @@
                "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60",
                "workload_context": "workloadContext",
                "key1": "value2",
+               "key3": "value3",
                "availability_zone_0": "zone0",
                "availability_zone_1": "zone1",
                "availability_zone_2": "zone2",
index 4231152..50d5642 100644 (file)
         "name" : "key1",
         "value" : "value1"
       },
+      {
+        "name" : "key2",
+        "value" : "value2"
+      },
       {
         "name" : "volume-group-id",
         "value" : "volumeGroupId"
index 29b5e9f..e06385e 100644 (file)
@@ -65,11 +65,11 @@ Auto-mount: <checked>
 \r
 Read-only: <unchecked>\r
 \r
-.. image:: images/Configure_ubuntu_SO_3.png\r
+.. image:: ../images/Configure_ubuntu_SO_3.png\r
 \r
 .\r
 \r
-.. image:: images/Configure_ubuntu_SO_4.png\r
+.. image:: ../images/Configure_ubuntu_SO_4.png\r
 \r
 Install Ubuntu in the VM\r
 ------------------------\r
@@ -111,7 +111,7 @@ Connect to the VM from your host computer
 -----------------------------------------\r
        The PuTTY SSH client is popular.  A connection to localhost:1022 (or whatever port you have forwarded) will go to the VM.\r
 \r
-.. image:: images/Configure_ubuntu_SO_7.png\r
+.. image:: ../images/Configure_ubuntu_SO_7.png\r
        \r
 Install VirtualBox Guest Additions\r
 ----------------------------------\r
@@ -159,6 +159,6 @@ Further Reading
 .. toctree::\r
    :maxdepth: 1\r
 \r
-   Install_Docker.rst\r
-   Configure_git_and_gerrit.rst\r
-   Workspace_and_Development_Tools.rst
\ No newline at end of file
+   installconfigure/Install_Docker.rst\r
+   installconfigure/Configure_git_and_gerrit.rst\r
+   installconfigure/Workspace_and_Development_Tools.rst
\ No newline at end of file
diff --git a/docs/installconfigure/Configure_git_and_gerrit.rst b/docs/installconfigure/Configure_git_and_gerrit.rst
new file mode 100644 (file)
index 0000000..c4598fa
--- /dev/null
@@ -0,0 +1,93 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 Huawei Technologies Co., Ltd.
+
+Configure git and gerrit
+========================
+
+Basics
+------
+The recommended version of git is 2.7.4 or later.  Check the installed version in the Ubuntu VM:
+
+.. code-block:: bash
+
+  git --version
+
+Create an SSH key to user with gerrit.  Use no passphrase.
+
+.. code-block:: bash
+
+  ssh-keygen -t rsa
+
+Enter your SSH public key (id_rsa) into gerrit:
+
+- Browse to https://gerrit.onap.org
+- Log in
+- Open the menu next to your name (under the green search button)
+
+.. image:: images/Configure_git_1.png
+
+- Select "Settings"
+- In the "Settings" sidebar, click "SSH Public Keys"`
+- Click "Add Key..."
+- Paste the entire contents of $HOME/.ssh/id_rsa.pub into the text area and click "Add".
+
+.. image:: images/Configure_git_2.png
+
+Install the git-review package.
+
+.. code-block:: bash
+
+  sudo apt update
+  sudo apt install git-review
+
+Create $HOME/.gitconfig (replace highlighted values with your own information):
+  [user]
+
+        name = FirstName LastName
+
+        email = you@yourcompany.com
+
+  [core]
+
+        autocrlf = false
+
+  [merge]
+
+        tool = vimdiff
+
+  [gitreview]
+
+        username = YourLinuxFoundationId
+
+**If you're behind a corporate firewall and your proxy server has SOCKS support...**
+
+You may be able to use the SSH protocol with git, which is preferred versus HTTP.  This method is known to work in the AT&T corporate network.
+Install the socat package, which allows you to tunnel SSH connections through a proxy that supports SOCKS:
+
+.. code-block:: bash
+
+  sudo apt update
+  sudo apt install socat
+
+Create (or append to) $HOME/.ssh/config (replace highlighted values with your information)
+
+  Host gerrit.onap.org
+
+  User userid
+
+  Hostname gerrit.onap.org
+
+  ProxyCommand socat - PROXY:host:%h:%p,proxyport=port
+
+  IdentityFile /home/userid/.ssh/id_rsa
+
+  ServerAliveInterval 10
+
+Verify that you have connectivity to gerrit through the proxy.  Answer "yes" to continue connecting, if prompted.
+
+.. code-block:: bash
+
+  ssh -p 29418 gerrit.onap.org
+
+.. image:: images/Configure_git_3.png
diff --git a/docs/installconfigure/Install_Docker.rst b/docs/installconfigure/Install_Docker.rst
new file mode 100644 (file)
index 0000000..91e40ca
--- /dev/null
@@ -0,0 +1,85 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+Install Docker
+===============
+
+Make sure curl is installed on the Ubuntu VM:
+
+.. code-block:: bash
+
+       sudo apt update
+       sudo apt install curl
+
+If you are behind a corporate firewall (replace "proxyhost:port" with your actual proxy information)
+       https_proxy="https://*proxyhost:port*" curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -
+       
+Otherwise:
+       curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -
+Expected Response:
+       OK
+Add the docker package repository:
+       sudo apt-add-repository "deb https://apt.dockerproject.org/repo ubuntu-xenial main"
+       
+Install packages:
+
+.. code-block:: bash
+
+    sudo apt update
+    sudo apt-cache policy docker-engine
+       sudo apt install docker-engine
+       sudo apt install docker-compose
+       
+If you are behind a corporate firewall, you will need to configure proxy settings for docker so that images may be obtained from internet repositories.  In the commands shown here, replace *"proxyhost:port"*, *"yourdomain1.com"*, and *"yourdomain2.com"* with appropriate values.
+       
+    Make the docker configuration directory:
+
+.. code-block:: bash
+       
+        sudo mkdir -p /etc/systemd/system/docker.service.d
+       
+    Edit (create) this file:
+
+.. code-block:: bash
+       
+               sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf
+       
+    Add these lines:
+
+        [Service]
+        
+               Environment="HTTP_PROXY=https://*proxyhost:port*"
+        
+               Environment="HTTPS_PROXY=https://*proxyhost:port*"
+        
+               Environment="NO_PROXY=localhost,127.0.0.1,.yourdomain1.com,.yourdomain2.com"
+       
+    Restart docker:
+
+.. code-block:: bash
+       
+        sudo systemctl daemon-reload
+        sudo systemctl restart docker
+
+Add yourself to the docker user group (replace "userid" with your user ID):
+
+.. code-block:: bash
+
+    sudo usermod -a -G docker *userid*
+
+Log out and log back in so that the user group change will takeeffect.
+
+Verify that you can connect to docker as yourself (i.e. not as root):
+
+.. code-block:: bash
+
+    docker ps
+
+Verify that you can download and run the hello-world container
+
+.. code-block:: bash
+
+    docker run hello-world
+       
+.. image:: images/Docker_install_1.png
\ No newline at end of file
diff --git a/docs/installconfigure/Workspace_and_Development_Tools.rst b/docs/installconfigure/Workspace_and_Development_Tools.rst
new file mode 100644 (file)
index 0000000..598439f
--- /dev/null
@@ -0,0 +1,107 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 Huawei Technologies Co., Ltd.
+
+Workspace and Development Tools
+===============================
+
+We recognize that there are different ways to set up a workspace and different tools that may be chosen.  This is just one way to set things up.
+
+Suggested Directory Structure
+------------------------------
+*NOTE*: You may have different versions of eclipse and java.
+
+       onap
+       
+               .m2
+               
+               apache-maven-3.3.9
+               
+               camunda-modeler
+               
+               eclipse-jee-neon-3-linux-gtk-x86_64
+               
+               jdk1.8.0_131
+               
+               workspace
+               
+                       SO
+                               chef-repo
+                               
+                               docker-config
+                               
+                               libs
+                               
+                               so
+                               
+                               so-config
+                               
+Java
+-----
+Download the latest Java_8_SE_Development_Kit_ from Oracle.   Select a Linux x64 package.
+
+Unpack it.
+
+.. _Java_8_SE_Development_Kit: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
+
+Maven
+------
+
+Download the Apache_Maven_3.3.9_ binary.  NOTE: 3.3.9 is the recommended version, even though much higher versions are available.
+
+Unpack it.
+
+.. _Apache_Maven_3.3.9: https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/
+
+Create an .m2 directory for maven and put settings.xml_ in it.  Edit the local repository path in settings.xml to make it correct for your environment.  Everything else should be OK.
+
+.. _settings.xml: https://wiki.onap.org/download/attachments/15997820/settings.xml?version=1&modificationDate=1506156303000&api=v2
+
+Camunda Modeler
+---------------
+
+Download the Camunda_Modeler_.  Select the Linux x64 package.
+Unpack it.
+
+.. _Camunda_Modeler: https://camunda.org/download/modeler/
+
+Eclipse
+-------
+
+Download Eclipse_for_Linux_.  Select the 64-bit Eclipse IDE for Java EE Developers.  Oxygen seems to be the latest version. These instructions were written for Neon.
+Unpack it.
+
+.. _Eclipse_for_Linux:  https://www.eclipse.org/downloads/eclipse-packages/?osType=linux
+
+In the eclipse directory, edit eclipse.ini
+
+       Add (or change) the -vm setting so that it points to your JDK.
+       
+       Adjust the maximum heap space (2GB is recommended).
+       
+       Example:
+       
+.. image:: images/Workspace_and_Development_Tools.png  
+       
+Eclipse Settings
+----------------
+
+**Configure eclipse to use your external maven 3.3.9 installation:**
+       Go to Window→Preferences→Maven→Installations
+       
+       Click "Add" and browse to your apache-maven-3.3.9 directory.  Click "OK" to select it.
+       
+       Click "Finish"
+       
+.. image:: images/Workspace_and_Development_Tools_2.png
+
+Make sure the external installation is selected:
+
+.. image:: images/Workspace_and_Development_Tools_3.png
+
+**Configure eclipse to use your settings.xml**
+       Go to Window→Preferences→Maven→User Settings
+       
+       Type the full path to your settings.xml file into the "User Settings" box and click "OK".
+       
+.. image:: images/Workspace_and_Development_Tools_4.png
\ No newline at end of file
index dbba5da..df6d921 100644 (file)
         name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level"
         level="WARN" />
 
+    <logger name="db.migration" level="DEBUG" />
     <logger name="org.apache.wire" level="DEBUG" />
     <logger name="org.onap" level="DEBUG" />
     <logger name="com.att.ecomp" level="DEBUG" />
         <appender-ref ref="asyncError" />
     </root>
 
-</configuration>
\ No newline at end of file
+</configuration>