Lightweight TOSCA orchestrator lightweight API
Project description
xOpera API
An HTTP API interface to the opera
orchestrator.
Mimics CLI commands.
WIP.
Development
Requires Python >= 3.7.
To begin:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
OpenAPI base code is generated with generate.sh
and is not checked in to the repository.
Other useful commands:
# openapi-generator basics
java -jar openapi-generator-cli-4.3.0.jar
java -jar openapi-generator-cli-4.3.0.jar help generate
java -jar openapi-generator-cli-4.3.0.jar validate --input-spec openapi-spec.yml --recommend
java -jar openapi-generator-cli-4.3.0.jar config-help --generator-name python-flask --full-details
Usage
With Docker:
docker-compose up --build -d
docker cp test.csar xopera-api_api_1:/app/
docker exec xopera-api_api_1 unzip test.csar
docker logs -f xopera-api_api_1
# prepare request inputs: service_template, inputs (in JSON object form, not a string)
curl -XPOST localhost:8080/validate -H "Content-Type: application/json" -d @inputs-request.json
curl -XPOST localhost:8080/deploy -H "Content-Type: application/json" -d @inputs-request.json
curl localhost:8080/status
curl localhost:8080/outputs
curl localhost:8080/info
curl -XPOST localhost:8080/undeploy
With a local development installation:
./generate.sh
python3 -m venv .venv
source .venv/bin/activate
pip install wheel
pip install -r requirements.txt
cd src/
python3 -m opera.api.cli
curl localhost:8080
Building for PyPI, releases
- If the
opera
dependency version has changed, you must reflect that change insetup.cfg
. - Generate sources with
./generate.sh
. - Test built packages in a Docker container.
- Only release tags without any local changes present.
- Manually create and upload releases onto GitHub, no automation for that.
- Build and test before pushing tags to reduce rollbacks.
pip3 install -r requirements.txt
./generate.sh
git tag -a 1.2.3 -m 1.2.3
rm -rfv dist/
python setup.py sdist bdist_wheel
docker run -it --rm \
-v $(realpath ./dist/):/dist/:ro \
-v $(realpath ./test.csar):/test.csar:ro \
-v $(realpath ./test-inputs-request.json):/test/test-inputs-request.json:ro \
python:3.8-buster bash
unzip -d /test/ /test.csar && cd /test/
pip3 install /dist/*.whl
opera-api
pip3 uninstall -y opera-api
pip3 install /dist/*.tar.gz
opera-api &
curl localhost:8080/info
curl -XPOST localhost:8080/deploy -H "Content-Type: application/json" -d @/test/test-inputs-request.json
curl localhost:8080/status
curl localhost:8080/outputs
curl -XPOST localhost:8080/undeploy
twine upload --repository <pypi|testpypi> dist/*
# upload to github manually
git push --tags
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
opera-api-0.3.0.tar.gz
(23.4 kB
view hashes)
Built Distribution
opera_api-0.3.0-py3-none-any.whl
(31.8 kB
view hashes)
Close
Hashes for opera_api-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e053da2843f6faf934cd4bb7c4152982865588ec037a20c4791b7421729520d3 |
|
MD5 | 776ee034b835066db9813750ddd6ef7a |
|
BLAKE2b-256 | 1a8250087f9810b34847ce8ddfea2bf026ec7d9c07a68720768441cc2febb56c |