sonic-restapi:基于 SONiC 的网络配置代理项目

可用于在运行 SONiC 的交换机上执行动态网络配置,通过暴露 HTTPS 端点提供 RESTful API,支持本地开发与交换机部署,提供 Docker 镜像构建及容器运行方案。【此简介由AI生成】

Branch24Tags0
FilesLast commitLast update
8 months ago
6 years ago
3 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 months ago
6 years ago
3 years ago
2 years ago
9 months ago
3 years ago
6 years ago
9 months ago
6 years ago
2 years ago
4 years ago
9 months ago
4 years ago
4 years ago
9 months ago
5 years ago
2 years ago
5 years ago
9 months ago
6 years ago
4 years ago
4 years ago
3 years ago
10 months ago
10 months ago
4 years ago
6 years ago
6 years ago

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

Build Rest-API

  1. Execute ./build.sh
  2. 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
  3. 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
  4. rest-api-image-test_local is for local testing on a dev VM and rest-api-image is for TOR testing/deployment
  5. 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. pytest -v

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

Introduction

可用于在运行 SONiC 的交换机上执行动态网络配置,通过暴露 HTTPS 端点提供 RESTful API,支持本地开发与交换机部署,提供 Docker 镜像构建及容器运行方案。【此简介由AI生成】

Customize your domain