# mjl85/natlas architecture

> Architecture diagram of the GitHub repository mjl85/natlas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mjl85/natlas
- Repository: https://github.com/mjl85/natlas

## Overview

##### Main Components Identification
The system should be represented with these key components:

a) Core Engine Layer:
- Discovery Engine (natlas/natlas.py)
- Network Management (natlas/network.py)
- Node Management (natlas/node.py, node_stack.py, node_vss.py)
- SNMP Interface (natlas/snmp.py)

b) Module Layer:
- Network Analysis Modules (get-arp-table.py, get-hosts.py, etc.)
- Configuration Management (modules/checkconfig.py, newconfig.py)

c) Output Layer:
- Output Handlers (natlas/output.py)
- Catalog Output (natlas/output_catalog.py)

##### Component Relationships

**[CLI Interface (natlas-cli.py)]**
- ↓
**[Configuration Layer (config.py)]**
- ↓
**[Core Engine Layer] ←→ [SNMP Interface]**
- ↙     ↓     ↘         ↑
**[Modules] [Output] [Network Discovery]**

##### Implementation Details

Technical aspects:
- SNMP v2 communication paths
- CDP/LLDP discovery flows
- Module execution paths
- Configuration file interaction

##### Specific Elements

a) Discovery Process Flow:
**[Root Node] → [SNMP Query] → [CDP/LLDP Discovery] → [Node Evaluation] → [ACL Processing]**

b) Module Integration:
**[Module API] → [Core Engine] → [Network Operations] → [Output Generation]**

##### Important Architectural Notes

- Modular design pattern
- Separation between discovery logic and output generation
- Configuration-driven behavior
- ACL-based discovery control flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI
        CLI_Interface["CLI Interface"]:::interface
    end

    subgraph Config
        Config["Configuration Core"]:::config
        ConfigMgmt["Configuration Management"]:::config
    end

    subgraph Core
        DiscoveryEngine["Discovery Engine"]:::core
        NetworkMgmt["Network Management"]:::core
        NodeMgmt["Node Management"]:::core
        MacHandler["MAC Address Handler"]:::core
        Utils["Utility Functions"]:::core
    end

    subgraph Interfaces
        SNMP["SNMP Interface"]:::interface
    end

    subgraph Modules
        DiagramGen["Diagram Generation"]:::module
        GetARP["ARP Table Module"]:::module
        GetHosts["Hosts Module"]:::module
        GetMAC["MAC Address Module"]:::module
    end

    subgraph Output
        OutputHandler["Output Handler"]:::output
        DiagramOutput["Diagram Output"]:::output
        CatalogOutput["Catalog Output"]:::output
    end

    %% Relationships
    CLI_Interface --> Config
    Config --> Core
    ConfigMgmt --> Config
    
    Core --> SNMP
    SNMP --> Core
    
    Core --> Modules
    Modules --> Core
    
    Core --> Output
    
    %% Click events
    click CLI_Interface "https://github.com/MJL85/natlas/blob/master/natlas-cli.py"
    click Config "https://github.com/MJL85/natlas/blob/master/natlas/config.py"
    click DiscoveryEngine "https://github.com/MJL85/natlas/blob/master/natlas/natlas.py"
    click NetworkMgmt "https://github.com/MJL85/natlas/blob/master/natlas/network.py"
    click NodeMgmt "https://github.com/MJL85/natlas/blob/master/natlas/node.py"
    click SNMP "https://github.com/MJL85/natlas/blob/master/natlas/snmp.py"
    click DiagramGen "https://github.com/MJL85/natlas/blob/master/modules/diagram.py"
    click GetARP "https://github.com/MJL85/natlas/blob/master/modules/get-arp-table.py"
    click GetHosts "https://github.com/MJL85/natlas/blob/master/modules/get-hosts.py"
    click GetMAC "https://github.com/MJL85/natlas/blob/master/modules/get-mac-addresses.py"
    click ConfigMgmt "https://github.com/MJL85/natlas/blob/master/modules/checkconfig.py"
    click OutputHandler "https://github.com/MJL85/natlas/blob/master/natlas/output.py"
    click DiagramOutput "https://github.com/MJL85/natlas/blob/master/natlas/output_diagram.py"
    click CatalogOutput "https://github.com/MJL85/natlas/blob/master/natlas/output_catalog.py"
    click MacHandler "https://github.com/MJL85/natlas/blob/master/natlas/mac.py"
    click Utils "https://github.com/MJL85/natlas/blob/master/natlas/util.py"

    %% Styles
    classDef core fill:#2374ab
    classDef interface fill:#57a773
    classDef config fill:#808080
    classDef module fill:#7d3f60
    classDef output fill:#ec9a29

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Interfaces"]:::interface
        L3["Configuration"]:::config
        L4["Modules"]:::module
        L5["Output Handlers"]:::output
    end
```
