aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 6ce651112d5bbabab442475ba5bf02fd8f0b2d81 (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
# CRUD Microservice (Gizmo)

## Overview
The CRUD microservice implements a set of RESTful APIs which allow a client to perform CREATE, UPDATE, GET, and DELETE operations on verticies and edges within the A&AI graph database.

## Getting Started

### Building The Microservice

After cloning the project, execute the following Maven command from the project's top level directory to build the project:

    > mvn clean install

Now, you can build your Docker image:

    > docker build -t onap/crud-service target

### Deploying The Microservice

Push the Docker image that you have built to your Docker repository and pull it down to the location from which you will be running the service.

**Create the following directories on the host machine:**

    ../logs
    ../appconfig
	../appconfig/auth

You will be mounting these as data volumes when you start the Docker container.

#### Configuring the Microservice

Create configuration file **../appconfig/crud-api.properties**

	# List of hostnames/addresses of the graph database
	crud.graph.host=graphhost1.onap.com,graphhost2.onap.com

	# Port on which to connect to the graph database
	crud.graph.port=2181

	# Name of the graph on which this service will operate
	crud.graph.name=aaigraphautomation

	# Backend storage type for the graph.  Types currently supported:
	#  - cassandra
	#  - hbase
	crud.storage.backend.db=cassandra

	# List of hostnames/addresses of the DMaaP/Kafka cluster on which to post notification events
	event.stream.hosts=kafkahost1.onap.com,kafkahost2.onap.com

	# Number of events to bath up before posting to DMaaP/Kafka
	event.stream.batch-size=100

	# Amount of time (in ms) to wait before sending batch of events (when batch does not reach batch-size)
	event.stream.batch-timeout=60000

Create configuration file **../appconfig/auth/crud-policy.json**

This policy file defines which client certificates are authorized to use the service's APIs.  An example policy file follows:

    {
        "roles": [
            {
                "name": "admin",
                "functions": [
                    {
                        "name": "search", "methods": [ { "name": "GET" },{ "name": "DELETE" }, { "name": "PUT" }, { "name": "POST" } ]
                    }
                ],
                "users": [
                    {
                        "username": "CN=admin, OU=My Organization Unit, O=, L=Sometown, ST=SomeProvince, C=CA"
                    }
                ]
            }
        ]
    }

Create keystore file **../appconfig/auth/tomcat\_keystore**
_tomcat\_keystore_

Create a keystore with this name containing whatever CA certificates that you want your instance of the CRUD service to accept for HTTPS traffic.

#### Start the service

You can now start the Docker container in the following manner:

	docker run -d \
	    -p 9520:9520 \
		-e CONFIG_HOME=/opt/app/crud-service/config/ \
		-e KEY_STORE_PASSWORD={{obfuscated password}} \
		-e KEY_MANAGER_PASSWORD=OBF:{{obfuscated password}} \
	    -v /<path>/logs:/opt/aai/logroot/AAI-CRUD \
	    -v /<path>/appconfig:/opt/app/crud-service/config \
	    --name crud-service \
	    {{your docker repo}}/crud-service

Where,

    {{your docker repo}} = The Docker repository you have published your CRUD Service image to.
    {{obfuscated password}} = The password for your key store/key manager after running it through the Jetty obfuscation tool.

## API Definitions

### Echo API

	URL: https://<host>:9520/services/crud-api/v1/echo-service/echo/<input>
	Method: GET
	Success Response: 200

### Vertex APIs
Gizmo exposes a set of APIs to operate on verticies within the graph.
[Vertex APIs](./VERTEX.md)

### Edge APIs
Gizmo exposes a set of APIs to operate on edges within the graph.
[Edge APIs](./EDGE.md)

### Bulk API
Gizmo exposes a bulk API to operate on multiple graph entities within a single request.
[Bulk API](./BULK.md)

## ASYNC PIPELINE
Gizmo is capable of working Synchronously and Asynchronously. Asynchronous Pipeline is explained
here: [Async Pipeline](./ASYNC.MD)