Léo BONNAIRE Léonard PRINCE Kowsigan ALAGARAJAH Hédi SFAXI Matthieu NSI ELA Mounir RADJABOU
The following Python module generates configs for a pre-defined backbone architecture.
It involves:
- Basic network connection
- OSPF routing within the backbone
- BGP connection with clients
- MPLS/VPN services
A backbone architecture is defined by its JSON file. An example is bb_config.json
The script connect to a GNS3 server to configure automatically every ISP routers (clients routers not included).
It requires to have a fully built GNS3 project.
The script generate a file called recap.txt
containing every router configuration.
(any troubles using git and GitHub ? Check How to use Git section)
- Install and configure GNS3's server
- Create a new GNS3 project
- Build your backbone architecture
- Starts your routers
- Write down the JSON file describing your architecture, including your client's edge routers
- In a Python virtual env (see section How to work with a Python virtual environment), install the requirements with
pip install -r requirements.txt
- Launch script with
python -m confgen -c <path-to-json-file> -n <gns3-project-name> [-v] [-d]
or try
python -m confgen --help
If you encouter any problem.
The writing to the routers can take time. Make a coffe before the start of the process.
If you encounter some problem during running the script, try to add -v
to have a more verbose output.
... or try a dry-run with the option -d
.
After each run, a file recap.txt
is created, making a recap of configs generated.
The current bb_config.json
describes the following architecture:
Please, update the scheme if you modify bb_config.json
!
The script connect to GNS3 server to retrieve the project. It is necessary to configure it correctly.
By default, the servers requires a password to connect and doesn't allow connection from any IP.
We'll need to change these two things in order to make the script working correctly.
You'll need to close every opened GNS3 project to modify server's settings.
In GNS3, Edit > Preferences > Server
- Check
Enable local server
- Uncheck
Protect server with password
- Check
Allow console connections to any local IP address
The other fields should be fine by default.
Apply the configuration. GNS3's server should restart, and you'll be able to open your project and launch the script.
Python virtual environments are used to create a virtual space specific to a single project, including its dependencies.
It avoids having a dirty workspace shared among several projects having different dependencies.
Of course, it requires to have Python installed on your machine !
To create a virtual environment, paste the following command in your shell:
python -m venv venv
It will create a new folder called venv/
which contains your virtual environment.
Usually these folder should not be added to git. Hence, remember to have a correct .gitignore
file.
(already taken care of here)
On Linux:
source venv/bin/activate
On Windows:
.\venv\Scripts\activate.bat
Your new prompt should now start with (venv)
meaning you've activated your environment.
You're (almost) ready to work :)
If your project requires some dependencies, a file called requirements.txt
should exist.
To install the dependencies, run
pip install -r requirements.txt
You're (finally) ready to work :) :)
On Windows : Install Git Bash
On Linux : probably already installed (try git --version
to check)
Configure your name and email with the following commands :
$ git config --global user.name "your name here"
$ git config --global user.email "your email here"
First thing needed is to create a set of SSH keys to access this repo.
(See tutorial full here : https://docs.github.com/fr/authentication/connecting-to-github-with-ssh)
Step-by-step process:
- Generate a SSH key and add it to your SSH-agent (detailed tutorial)
ssh-keygen -t ed25519 -C "your_email@example.com"
Do not change the default folder and enter a solid passphrase.
Then add your key to your SSH agent
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_ed25519
- Add it to your GitHub profile
cat ~/.ssh/id_ed25519.pub
Copy the exact output of this command and paste it on Github.
git clone git@github.com:leoNord462/3tca-projet-nas.git
This creates a folder named after the GitHub repo. cd
to this repo to work within it.
With the above configuration, you should be able to access with read and write access to the distance repo.
Before working on the repo, remember to pull the changes made by other.
git pull origin <your-branch>
When you finished a task and want to commit your changes, use
$ git add -A # This add your files to be commited
$ git commit -m "an-explicit-message-to-describe-your-work" # Commit your changes on your local repo
$ git push origin <your-branch> # Push your commit to github
The use of GitHub might be handy for beginners so don't hesitate to ask.
To work on a specifiq branch:
$ git fetch origin # retrieve remote branches
$ git checkout <your-branch> # change to branch you work on
! Please, don't work on branch master. The branch master should be a clean branch. !
When you work on a new issue, create the issue (via the milestone) and a related branch on github, then checkout locally with the above commands. When you work is done and ready for the branch master, create a pull request that will be reviewed before merging.