Skip to content

Sagar062192/vlan-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VLAN Assignment Processor

Overview

  • This project processes network request and VLAN CSV files to generate an output file that maps requests to device ports and VLANs. It supports both redundant and non-redundant requests and assigns VLANs based on predefined rules.

  • The script reads input CSV files, sorts VLAN data, applies request logic, and writes the final results to an output CSV file.


Input Files

requests.csv

Contains request details:

request_id,redundant
1,1
2,0
  • request_id: Unique request identifier
  • redundant: 1 for redundant, 0 for non-redundant

vlans.csv

Contains VLAN availability:

device_id,port,vlan_id
101,0,1001
101,1,1002
  • device_id: Network device identifier
  • port: Port number (0 or 1)
  • vlan_id: VLAN identifier

Logic Summary

  • VLANs are sorted by vlan_id
  • Redundant requests require two ports (0 and 1) on the same device
  • Non-redundant requests use only the primary port (port 1)
  • Assigned VLANs are removed from the pool once used

Output output.csv

Generated file format:

request_id,device_id,primary_port,vlan_id

How to Run

  1. Ensure Python 3 is installed
  2. Place input files in the csv/ directory
  3. Run:
python main.py

Dependencies

  • Python 3.x
  • Standard libraries only (csv, operator, logging, time)

Notes

  • Input CSV values must be integers
  • The script logs errors but continues execution
  • Execution time is printed after completion

About

This project processes network request and VLAN CSV files to generate an output file that maps requests to device ports and VLANs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages