aboutsummaryrefslogtreecommitdiffstats
path: root/extra/sql/dump/load-fake-data.sh
blob: 5729726831dae79247c31c5bc09ab4f1fa56c65e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

###
# ============LICENSE_START=======================================================
# ONAP CLAMP
# ================================================================================
# Copyright (C) 2019 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============================================
# ===================================================================
# 
###

mysql -uroot -p$MYSQL_ROOT_PASSWORD -v -f cldsdb4 < /docker-entrypoint-initdb.d/dump/test-data.sql
DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0

**********************************************************
Methods to run PDP-D
**********************************************************

.. contents::
    :depth: 2

There are two methods you can use to run a PDP-D for testing purposes:

1. Using Docker

2. Using Eclipse

Using Docker
^^^^^^^^^^^^
**Step 1:** Clone the integration/csit repository.

You can find the repo here: https://gerrit.onap.org/r/admin/repos/integration/csit.
Although this repository is used for CSIT testing, we can use this as a means to get a PDP-D up and running with docker.

    .. code-block:: bash

        git clone "https://gerrit.onap.org/r/integration/csit"

**Step 2:** Note the "docker-compose" commands that will be used.

    .. code-block:: bash

        docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml up -d

        docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml down -v

Note that ${WORKSPACE} refers to the local path where the csit repository is.

**Step 3:** Edit the "docker-compose-drools-apps.yml" file.

Take a look at the "csit/scripts/policy/docker-compose-drools-apps.yml" file. It should look similar to this:

    .. image:: img/docker/yamlClone.png

The following changes need to be made based on which version you are running and your local setup.

    .. code-block:: bash

        ${POLICY_MARIADB_VER} should be "10.2.14" (without quotes, version subject to change)

        ${WORKSPACE} should be the absolute path to the cloned "csit" repository.

        ${POLICY_DROOLS_APPS_VERSION} should be "1.6.0" (without quotes, version subject to change).

If you are using MacOS, you will also need to make the following changes:

    .. code-block:: bash

        expose:
        - 6969
        - 9696

        will need to be changed to:

        ports:
        - "6969:6969"
        - "9696:9696"

**Step 4:** Start containers and interact with PDP-D.

    .. code-block:: bash

        docker-compose -f scripts/policy/docker-compose-drools-apps.yml up -d
        docker container ls
        docker exec -it drools bash

    .. image:: img/docker/dockerComposeUp.png

    .. code-block:: bash

        policy status

    .. image:: img/docker/policyStatus.png

    .. code-block:: bash

        # launches subshell where telemetry commands can be executed
        telemetry

        ls

        cd controllers

        # Get the current controllers
        get

    .. image:: img/docker/telemetryCmd.png

    .. code-block:: bash

        # Get information about the "frankfurt" controller
        get frankfurt

    .. image:: img/docker/getFrankfurt.png


    .. code-block:: bash

        docker-compose -f scripts/policy/docker-compose-drools-apps.yml down -v

    .. image:: img/docker/dockerComposeDown.png

In the next section, you will see more about using telemetry commands and interacting with the PDP-D.

Using Eclipse
^^^^^^^^^^^^^

**Step 1:** Clone 'drools-pdp' repository and create a new directory for eclipse workspace.

Link to repository: https://gerrit.onap.org/r/admin/repos/policy/drools-pdp
For the purposes of this demo, we will create an new directory to use as a workspace for eclipse.

    .. code-block:: bash

       $ git clone "https://gerrit.onap.org/r/policy/drools-pdp"
       Cloning into 'drools-pdp'...
       remote: Counting objects: 59, done
       remote: Finding sources: 100% (30/30)
       remote: Total 14406 (delta 0), reused 14399 (delta 0)
       Receiving objects: 100% (14406/14406), 3.23 MiB | 628.00 KiB/s, done.
       Resolving deltas: 100% (6630/6630), done.
       Checking out files: 100% (588/588), done.

       $ mkdir workspace-drools-pdp

       $ ls
       drools-pdp/  workspace-drools-pdp/

The "drools-pdp/" directory contains the cloned repository and "workspace-drools-pdp/" is an empty directory.

**Step 2:** Import "drools-pdp" as an existing maven project.

Open Eclipse. Hit the **browse** button and navigate to the "workspace-drools-pdp/" directory. Select that folder as the workspace directory and hit **launch**.

    .. image:: img/eclipse/selectDirectory.png

Select File -> Import -> Maven -> Existing Maven Projects -> Next

    .. image:: img/eclipse/importMavenProject.png

Select **Browse** and navigate to the root directory of the cloned project. Hit **Select All** to make sure all projects are included and select **Finish**.

    .. image:: img/eclipse/selectProjectsToImport.png

**Step 3:** Run "policy-management" as a java application

All of the projects will appear in the package explorer after they finish importing. Right click on "policy-management", select "Run As", and select "Java Application".

    .. image:: img/eclipse/runAsJavaApp.png

Type "main" and select the option "Main - org.onap.policy.drools.system" then hit **OK**.

    .. image:: img/eclipse/mainAppSelection.png

If everything is successful, the PDP-D will start running and you will notice output displayed in the console. In the next section, you will see how to interact with the PDP-D using telemetry commands.