diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8d3b0c9c3ac5a43f61799a6bdfea45d96d16e804 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,22 @@ +# The devcontainer will be based on Python +# The base container already has entrypoint, vscode user account, etc. out of the box +FROM mcr.microsoft.com/devcontainers/python:3-bookworm + +# containelab version will be set in devcontainer.json +ARG _CLAB_VERSION + +# install some basic tools inside the container +# adjust this list based on your demands +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + sshpass \ + curl \ + iputils-ping \ + htop \ + && rm -rf /var/lib/apt/lists/* \ + && rm -Rf /usr/share/doc && rm -Rf /usr/share/man \ + && apt-get clean + +# install preferred version of the containerlab +RUN bash -c "$(curl -sL https://get.containerlab.dev)" -- -v ${_CLAB_VERSION} \ + && pip3 install --user yamllint diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000000000000000000000000000000000..2c1f522e5e9e37c329a73206bbae389d4b843e10 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the + // README at: https://github.com/devcontainers/templates/tree/main/src/python + { + "name": "clab-for-arm", + "build": { + "dockerfile": "Dockerfile", + "args": { + "_CLAB_VERSION": "0.46.1" + } + }, + "features": { + // Containerlab will run in a docker-in-docker container + // it is also possible to use docker-outside-docker feature + "ghcr.io/devcontainers/features/docker-in-docker:2.7.0": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/go:1": { + "version": "1.21.1" + } + }, + // add any required extensions that must be pre-installed in the devcontainer + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.vscode-docker", + "golang.go", + "EditorConfig.EditorConfig", + "eamodio.gitlens", + "ms-vscode.makefile-tools", + "redhat.vscode-yaml" + ] + } + } + } diff --git a/Makefile b/Makefile index 515245e72d7247813096e8cc9c046047361dfdf6..15720a9259c0fbc47c1700f5c208a268cf88364c 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,8 @@ start-dev-env: containerize-gosdn containerize-plugin-registry stop-dev-env: ./scripts/simple-dev-setup.sh --mode stop --topology dev_env_data/clab/basic_two_aristas.yaml +generate-certs: generate-gnmi-target-certs generate-gosdn-certs + clean: $(GOCLEAN) rm -rf $(BUILD_ARTIFACTS_PATH) diff --git a/README.md b/README.md index c7f72b77ae412bded03a142ff8330b1411263158..3ab3886cee1b70166549d6af3cf3abd5687974c0 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ There you can also find some tutorials to get to know the SDN controller: - [Playground](#playground) - [Additional services](#additional-services) - [Configuration file](#configuration-file) +- [Development-Tutorial](#development-tutorial) - [Contributing](CONTRIBUTING.md) - [License](LICENSE) - [CI Status](#ci-status) @@ -226,8 +227,27 @@ Information about how to use the CLI is provided in the `cli` folder, see [here] ## Development Tutorial +There are several options on how to create a dev environment. A more classic way or the option to use devcontainers with VSCode. + +### Devcontainer - local + +For this method you only need `docker` and `vscode` with the plugin `Dev Containers` from Microsoft installed. +After you installed the required tools, you can simply open the folder in the dev container. +Either you click on `Open in Container` if a pop-up appears on the bottom right, or by selecting `Open in Container` after clicking on `Remote Explorer` in the left bar in VSCode. Please note: depending on your internet connection and the performance of the device, the initial creation of the container can take several minuts or longer! Furthermore the initial git discovery of every submodule in this repo (if installed) can also take some minutes. + +The devcontainer has everything you need in it (even relevant VSCode plugins), so you should not need anything more. +Please keep in mind that this setup is not tested thoroughly! + +### Devcontainer - remote + +If for example your local device is not very performant, an ARM device or youw ant for other reasons use a remote device to develop, you can use the devcontainer setup remotely via SSH on a different device/server. + +TBD. + +### Classic + +The classic installation requires `go`, `docker`, `docker compose` and `containerlab`. To help with developing there is a small script available, which helps to create the complete dev environment. -For it to work, you need `go`, `docker`, `docker compose` and `containerlab`. For a quick start simply use `make start-dev-env` to start everything. This can take a while. Afterwards, you see the output of goSDN, to stop it hit Ctrl+C. To stop everything else use `make stop-dev-env`. diff --git a/dev_env_data/clab/basic_one_arista.yaml b/dev_env_data/clab/basic_one_arista.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fe4c15fc37baa0eda7f5a485eda5e555e9b4f3a3 --- /dev/null +++ b/dev_env_data/clab/basic_one_arista.yaml @@ -0,0 +1,16 @@ +name: gosdn_one_arista + +mgmt: + network: gosdn-net + ipv4-subnet: 172.100.0.0/16 + ipv6-subnet: 2001:db8::/64 + +topology: + kinds: + ceos: + image: registry.code.fbi.h-da.de/danet/containers/ceos:4.28.2F + + nodes: + ceos0: + kind: ceos + mgmt-ipv4: 172.100.0.11 diff --git a/dev_env_data/clab/basic_two_aristas.yaml b/dev_env_data/clab/basic_two_aristas.yaml index 690e3a89ddaddaaa3d794c2d6151ca40a98842bc..266d7dc37c543d45fcf9a4652753385dc37899ba 100644 --- a/dev_env_data/clab/basic_two_aristas.yaml +++ b/dev_env_data/clab/basic_two_aristas.yaml @@ -1,4 +1,4 @@ -name: gosdn_sts_demo_basic +name: gosdn_two_aristas mgmt: network: gosdn-net