The goal of this project is to generate switch distribution (can handle differents brands/models) configuration with templates of settings
#Preview
- Twig - template engine
- Bulma - CSS framework
- Font Awesome - icon library
- PHP >= 7.0.0
- Twig >= 2.0
- SQLite3
- PDO with SQLite drivers
- Create
config/config.jsonwith good parameters (example :config/config.example) - Open your browser and setup the database by going on
setup.php
- Chose the company, the model, the template and put the switch number (switch number will be the host IP and will be truncated with the hostname)
- You can change the textarea to readonly to edit mode and vice versa to edit the configuration
- You can copy/download the configuration
- You can create one or more template
-
Template name : It's the template name display on New configuration page
-
SNMP :
community : It's like an user id or password for SNMP
right : RO (Read only) / RW (Read Write)
-
Authorization (Used for everything need a authentification SSH / Enabled configuration etc...)
User : Your username
Password : Your password (save in clear text)
Confirmed password : Your password
-
Banner Motd : Message of the day
-
Spanning Tree : Enable or not spanning tree
-
Default gateway
IP : IP of your default gateway
Netmask : Netmask of your default gateway
-
VLAN : You can create VLAN with a network or not
ID : VLAN ID
Name : VLAN Name
IP : Network IP of your VLAN (optionnal)
Netmask : Netmask of your VLAN (optionnal)
-
Port template : You can assign your VLAN to a port template
Distribution port : Used for every port who is not a Uplink port
Uplink port : Can be set to 0-5 on First or Last ports and every ports who is on the last range (range must be > 1) will be added by default as uplink ports
- example Last ports = 0 : FastEthernet0/ 0 to 48 - No default Uplink port
- example Last ports = 0 : FastEthernet0/ 0 to 48 and GigabitEthernet0/ 1 to 2 - default Uplink port = GigabitEthernet0/ 1 to 2
- example Last ports = 2 : FastEthernet0/ 0 to 48 - No default Uplink port + FastEthernet0/ 47 - 48 Uplink
- example Last ports = 2 : FastEthernet0/ 0 to 48 and GigabitEthernet0/ 1 to 2 - default Uplink port = GigabitEthernet0/ 1 to 2 + FastEthernet0/ 47 - 48 Uplink
How add a new model ?
You have two examples at the moment : the Cisco 2950_24T and the Cisco 2960_48TT
For example we want to add the Dell 5324
- Create a directory with the company name
class/SwitchConfGenerator/Delland a subdirectory named Modelclass/SwitchConfGenerator/Dell/Model - Create 3 php class file
Acl,Cryptoand a company class fileclass/SwitchConfGenerator/Dell/Dell.php - Create in subdirectory Model a class file with concatenate name company_model.php
class/SwitchConfGenerator/Dell/Model/Dell_5324.php - Create a directory with the company name
templates/project/Dell - Create a template with concatenate name company_model.php
(model name is the name defined in
class/SwitchConfGenerator/Dell/Model/Dell_5324.phpin$model)templates/project/Dell/Dell_5324.twig
-
class/SwitchConfGenerator/Dell/Acl.phpNot used at the moment (Next update) -
class/SwitchConfGenerator/Dell/Crypto.php- Copy
class/SwitchConfGenerator/Cisco/Crypto.phpand replaceCiscobyDellon namespace and implement the encryption method used by Dell
- Copy
-
class/SwitchConfGenerator/Dell/Dell.php- Copy
class/SwitchConfGenerator/Cisco/Cisco.phpand just replaceCiscobyDellon classname and namespace
- Copy
-
class/SwitchConfGenerator/Dell/Model/Dell_5324.php- Copy
class/SwitchConfGenerator/Cisco/Model/Cisco_2950_24T.phpand replaceCiscobyDellon namespace, use, replace the name of the class byDell_5324who must extendsDell. $modelis the general name model of the switch for example you have2960-24TC,2960-48TC,2960G-8TCetc... it must be2960for our case it's5324because there is no different model of 5324.$resumePortis an array of ports on the switch for the 5324 it must be :
$resumePort = [ [ "first_port_id" => 1, "last_port_id" => 24, "name" => 'ethernet g' ] ];
- Copy
-
templates/project/Dell/Dell_5324.twig- You have
switchobject :- switch.hostname (hostname)
- switch.default_gateway.ip and switch.default_gateway.netmask (IP and Netmask)
- switch.bannerMotd (bannerMotd)
- switch.spanningTree (True/False)
- switch.snmp.community and switch.snmp.permissions (Community and Permissions)
- switch.authorization.username and switch.authorization.password (Username and Password)
- switch.listVlan (Array of VLAN), VLAN :
- vlan.id
- vlan.name
- vlan.ip
- vlan.netmask
- switch.port (Array of Port), Port:
- port.name
- port.untagged (id of untagged VLAN)
- port.tagged (Array of VLAN id)
- You have
- Go on the website on
Model templates - Add the company
Dell - Add the model
5324
Easy, no ? :)
Feel free to adapt template to your use case !
The code is under CeCILL license.
You can find all details here: https://cecill.info/licences/Licence_CeCILL_V2.1-en.html
Copyright © Lyon e-Sport, 2018
Contributor(s):
-Ortega Ludovic - [email protected]
-Etienne Guilluy - [email protected]
