summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 578c7fb7f8b0c262598f891104e97bf038e38ba5 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# ONAP data provider

Data ingestion service for ONAP

## Description

Data provider is a project to provide a tool to automate common ONAP resource creation. For many of tasks in ONAP some resources are needed and could be created once, like cloud region, complex or customer in A\&AI. With that tool it can be automated to create them for every ONAP instance. It can be also used to create requested resource on already running instance on demand.

## Usage

This project is intended to be included in automation chain, e.g. triggered from the pipeline.
You can also run it locally using Python interpreter or Docker image.

### Installation

To run `onap-data-provider` Python >= 3.8 version is required. Install it using

```
python setup.py install
```

command. You can call then

```
onap-data-provider
```

command.

### Run locally

When installed `onap-data-provider` is ready to work. We need some data to be created. Let's use `samples/vendor.yaml` and create SDC's Vendor resource. Call

```
onap-data-provider -f samples/vendor.yaml
```

and in your ONAP instance Vendor resource should be created. If that resource already exists no new data will be created. Check `samples` directory to get more examples of files which describes resources to create.

You can use multiple files as an input:

```
onap-data-provider -f samples/vendor.yaml -f samples/vsp.yaml
```

Directories could be used as well:

```
onap-data-provider -f samples/
```

### Configuration

Configuration is needed if your environment setup is different that usuall so ONAP components listen on different hosts/ports than default, so are available on other URLs than:

```
AAI_URL     = "https://aai.api.sparky.simpledemo.onap.org:30233"
CDS_URL     = "http://portal.api.simpledemo.onap.org:30449"
MSB_URL     = "https://msb.api.simpledemo.onap.org:30283"
SDC_BE_URL  = "https://sdc.api.be.simpledemo.onap.org:30204"
SDC_FE_URL  = "https://sdc.api.fe.simpledemo.onap.org:30207"
SDNC_URL    = "https://sdnc.api.simpledemo.onap.org:30267"
SO_URL      = "http://so.api.simpledemo.onap.org:30277"
VID_URL     = "https://vid.api.simpledemo.onap.org:30200"
CLAMP_URL   = "https://clamp.api.simpledemo.onap.org:30258"
VES_URL     = "http://ves.api.simpledemo.onap.org:30417"
DMAAP_URL   = "http://dmaap.api.simpledemo.onap.org:3904"
```

If you want to use another URLs you need to override default `onap-data-provider` settings by create Python file with values you want to use. Example: I want to test `onap-data-provider` data creation on my "test" ONAP instance which is available on "172.17.0.1" IP address, so I need to create `my_test_onap_instance_settings.py` Python file which looks:

```
AAI_URL     = "https://172.17.0.1:30233"
CDS_URL     = "http://172.17.0.1:30449"
MSB_URL     = "https://172.17.0.1:30283"
SDC_BE_URL  = "https://172.17.0.1:30204"
SDC_FE_URL  = "https://172.17.0.1:30207"
SDNC_URL    = "https://172.17.0.1:30267"
SO_URL      = "http://172.17.0.1:30277"
VID_URL     = "https://172.17.0.1:30200"
CLAMP_URL   = "https://172.17.0.1:30258"
VES_URL     = "http://172.17.0.1:30417"
DMAAP_URL   = "http://172.17.0.1:3904"
```

and then if I call

```
ONAP_PYTHON_SDK_SETTINGS=my_test_onap_instance_settings onap-data-provider ...
```

all data are going to be created on my local instance.

### Set proxy

ONAP data provider can be run with proxy configured. You need to pass urls you want to use for proxy connection as `--proxy` arguments. Call `onap-data-provider -f <infra-file> --proxy http://localhost:8080 https://localhost:8080` to setup proxy for `http` and `https` on `localhost:8080` address.

## Data verification

You can verify the data provided is correct, before you would try to actually push it
to the ONAP instance. To do so, use the flag `--validate-only`:

```
onap-data-provider -f samples/vendor.yml --validate-only
```

For reference, please see example data files under `samples/` directory.

## Development and testing

The following utilities are used within the project:

- Black
- mypy
- pydocstyle

To run all the tests (unit tests, linter and mypy checks), install tox and then run it:

```
pip install tox
tox .
```

## Licenses

The software that data-provider is built on uses the following licenses.

- Apache 2 License: onapsdk
- MIT license: PyYAML, jsonschema