GithubHelp home page GithubHelp logo

hartl3y94 / nca-rest-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from np-guard/nca-rest-server

0.0 0.0 0.0 19 KB

A Flask-based REST-API server for NCA

License: Apache License 2.0

Python 100.00%

nca-rest-server's Introduction

nca-rest-server

A Flask-based REST-API server for Network-Config-Analyzer (NCA).

Installation

git clone [email protected]:np-guard/nca-rest-server.git
cd nca-rest-server
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

Usage

Running the server

source venv/bin/activate
python -m nca_rest_server

The server can now be accessed via port 5000.

Setting cluster namespaces

Use the namespace_list path to post a list of namespace resources. For example, loading namespaces from a JSON file with a namespaces list can be done as follows.

curl -X POST -H Content-Type:application/json -d @tests/basic/ns_list.json localhost:5000/namespace_list

Setting cluster pods

Use the pod_list path to post a list of pod resources. For example, loading pods from a JSON file with a pod list can be done as follows.

curl -X POST -H Content-Type:application/json -d @tests/basic/pods_list.json localhost:5000/pod_list

Setting cluster network policies

Use the policy_sets path to post a list of network policies. Each post returns a unique identifier for the posted set of network policies. This identifier can be used to later query NCA findings on this set. For example, loading network policies from a JSON file with a list of network policies can be done as follows.

curl -X POST -H Content-Type:application/json -d @tests/basic/testcase2-networkpolicies.json localhost:5000/policy_sets

A valid response code should be 201, and the response body should include the set id, e.g., set_0.

A GET request from the policy_sets path returns the available policy sets. Adding the policy-set identifier to the path returns details for this set. For example

curl localhost:5000/policy_sets/set_1

Listing findings for a set of network policies

For a given set of network policies with set id <set_id>, a GET request from the path policy_sets/<set_id>/findings returns a JSON response with lint findings for each one of the policies. For example

curl localhost:5000/policy_sets/set_0/findings | jq

nca-rest-server's People

Contributors

dependabot[bot] avatar zivnevo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.