Skip to content

JiriFrankCZ/ubiquiti

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Network Device Management CLI

Java Interview Assignment - Network device management system with Spring Shell CLI.

Requirements ✅

  • Device registration (type, MAC, uplink)
  • List devices sorted by type
  • Find device by MAC
  • Network topology visualization
  • Subtopology from specific device

Quick Start

# Build and run
mvn package
java -jar target/network-device-cli-1.0.0.jar

Prerequisites: Java 21+
Note: For best experience, use terminal with emoji font support

Commands

# Show all commands
help

# Show detailed help for specific command
help register-device

# Basic usage
register-device --type GATEWAY --mac aa:bb:cc:dd:ee:01
register-device --type SWITCH --mac aa:bb:cc:dd:ee:02 --uplink aa:bb:cc:dd:ee:01
list-devices
find-device --mac aa:bb:cc:dd:ee:01
show-topology
show-topology-from --mac aa:bb:cc:dd:ee:02
clear

Architecture

Tech Stack: Spring Boot 3.5.4, Spring Shell 3.4.1, Java 21, Maven

Design:

  • Bidirectional tree structure (parent/children references)
  • HashMap storage for O(1) MAC lookup
  • Custom MAC validation with normalization
  • Global exception handling

Key Features:

  • Prevents circular references (tree-only topology)
  • Duplicate device validation
  • Type-based sorting (Gateway > Switch > Access Point)
  • Interactive CLI with sample data

Testing

  • Integration tests for all CLI commands
  • Unit tests for validation and exceptions
  • Edge case coverage (duplicates, invalid MACs)

Configuration

# application.yml
network:
  device:
    initialize-default-data: true    # Load sample network on startup
    max-devices-per-uplink: 100      # Max children per parent device
    max-network-depth: 10            # Max topology tree depth
    enable-mac-normalization: true   # Convert MAC formats (aa-bb to aa:bb)

Sample Network

🌐 Gateway: aa:bb:cc:dd:ee:01
├── 🔀 Switch: aa:bb:cc:dd:ee:02
│   ├── 📡 Access Point: aa:bb:cc:dd:ee:04
│   └── 📡 Access Point: aa:bb:cc:dd:ee:05
└── 🔀 Switch: aa:bb:cc:dd:ee:03
    └── 📡 Access Point: aa:bb:cc:dd:ee:06

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages