GithubHelp home page GithubHelp logo

isabella232 / sonic-restapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sonic-net/sonic-restapi

0.0 0.0 0.0 263 KB

restful api server

License: Other

Shell 1.65% Makefile 2.06% C++ 24.12% Thrift 1.89% C 0.61% Python 27.17% Go 41.55% Dockerfile 0.94%

sonic-restapi's Introduction

SONiC-restapi

Description

This is a configuration agent which exposes HTTPS endpoints to perform dynamic network configuration on switches running SONiC. It restful API server is go-server-server

Getting Started

Fetch Dependencies

  1. mkdir debs; cd debs
  2. sudo wget https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/lastSuccessfulBuild/artifact/target/debs/*zip*/debs.zip
  3. sudo unzip debs.zip

Build Rest-API

  1. Modify copy.sh SDIR path to point to your downloaded debs from the previous step
  2. Execute ./build.sh
  3. The above should generate 2 Docker images, 1 which is used for local development on your VM and 1 which is used for deployment on a TOR
  4. Run docker images to check if rest-api dockers were generated
    REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE 
    rest-api-image latest d2815fcb7356 2 days ago 222MB
    rest-api-image-test_local latest e62219a0bae2 2 days ago 222MB
  5. rest-api-image-test_local is for local testing on a dev VM and rest-api-image is for TOR testing/deployment
  6. The production image is also stored into a compressed archive rest-api-image.gz

Running Rest-API container

Run Rest-API container locally on a VM and execute unit tests

  1. docker run -d --rm -p8090:8090 -p6379:6379 --name rest-api --cap-add NET_ADMIN --privileged -t rest-api-image-test_local:latest
  2. cd test
  3. python apitest.py

Login to Rest-API container and check logs

  1. docker exec -it rest-api bash
  2. vim /tmp/rest-api.err.log

Run Rest-API container on a switch

  1. scp/copy over the generated archive(rest-api-image.gz) to your switch
  2. docker load < rest-api-image.gz
  3. docker run -d -p=8090:8090/tcp -v /var/run/redis/redis.sock:/var/run/redis/redis.sock --name rest-api --cap-add NET_ADMIN --privileged -t rest-api-image:latest

sonic-restapi's People

Contributors

sumukhatv avatar hui-ma avatar prsunny avatar anish-n avatar sojindal avatar pavel-shirshov avatar maduramarathe9 avatar lguohan avatar johntconklin avatar dependabot[bot] avatar weixchen1215 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.