# ciscoise/ciscoise-terraform-automation-azure-functions architecture

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

- Interactive diagram: https://gitdiagram.com/ciscoise/ciscoise-terraform-automation-azure-functions
- Repository: https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions

## Overview

##### Project type and purpose
- This is a Python-based, serverless Azure Functions project whose sole purpose is to automate and orchestrate the configuration of Cisco ISE (Identity Services Engine) nodes (Primary, Secondary, PSN) in an Azure cloud environment.
- It contains exactly two functions: a Timer-triggered function and an HTTP-triggered function.

##### File structure
- Top-level:
- host.json – Azure Functions host configuration
- requirements.txt – Python dependencies
- HttpTrigger1/ – folder for the HTTP-trigger function
- TimerTrigger1/ – folder for the Timer-trigger function
- Each function folder contains:
- __init__.py – the Python entry point
- function.json – trigger definition (schedule or HTTP)
- sample.dat or readme.md – usage samples

##### README for additional insights
- Timer function:
- Runs on a schedule (cron)
- Checks the status of the Primary ISE node
- Verifies node sync
- Upon success, calls the HTTP function
- HTTP function:
- Fetches key–value settings from Azure App Configuration
- Executes the “configure ISE node” logic (Primary, Secondary, PSN)

##### Main components and interactions
a. Components
- Azure Function App (the container for both functions)
- TimerTrigger1 (the scheduled job)
- HttpTrigger1 (the HTTP API)
- Azure App Configuration (holds Key–Value pairs for credentials, endpoints, etc.)
- Cisco ISE cluster (Primary Node, Secondary Node, PSN Node)
- (Optional) Azure Application Insights or Storage Account for logging/monitoring
b. Relationships & data flow
1. TimerTrigger1 fires on a schedule → Azure Function runtime
2. TimerTrigger1 checks Primary ISE node status (REST API call over the network)
3. TimerTrigger1, upon “Up” & “In-Sync” → invokes HttpTrigger1 (internal HTTP call or via Azure Functions orchestration)
4. HttpTrigger1 starts, reads all configuration parameters from Azure App Configuration
5. HttpTrigger1 calls the “configureNode” routine to push configuration to each ISE node (Primary, Secondary, PSN) via their REST APIs
6. (Optional) Both functions write logs/telemetry to Application Insights or a Storage Account
c. Architectural patterns & design principles
- Serverless, event-driven architecture
- Single-responsibility functions: one for health checking & orchestration, one for config application
- Externalized configuration via Azure App Configuration (12-factor principle)
- Stateless compute (each function invocation is independent)
d. Technologies, frameworks, libraries
- Azure Functions (Python)
- Azure App Configuration service
- Python requests or an ISE SDK (in requirements.txt)
- host.json defines global settings

##### Details
- Component names matching your folder names (TimerTrigger1, HttpTrigger1).
- The Python runtime version (from requirements.txt or host.json) if relevant.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers and Components
    subgraph "Azure Function App"
        direction TB
        Runtime["Function App Runtime\n(host.json)"]:::compute
        Timer["TimerTrigger1\n(cron schedule)"]:::trigger
        HTTP["HttpTrigger1\n(HTTP POST)"]:::trigger
    end

    AppConfig["Azure App Configuration"]:::config
    Logging["Application Insights/\nStorage Account"]:::monitor
    subgraph "Cisco ISE Cluster"
        direction TB
        ISE1["Primary Node"]:::external
        ISE2["Secondary Node"]:::external
        ISE3["PSN Node"]:::external
    end

    %% Connections
    Timer -->|cron| Runtime
    Runtime -->|executes| Timer
    Timer -->|REST GET| ISE1
    Timer -->|invoke HTTP POST| HTTP
    HTTP -->|GET settings| AppConfig
    HTTP -->|REST POST| ISE1
    HTTP -->|REST POST| ISE2
    HTTP -->|REST POST| ISE3
    Timer -->|logs| Logging
    HTTP -->|logs| Logging

    %% Click Events for Component Mapping
    click Runtime "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/host.json"
    click Runtime "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/requirements.txt"
    click Timer "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/TimerTrigger1/__init__.py"
    click Timer "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/TimerTrigger1/function.json"
    click Timer "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/TimerTrigger1/readme.md"
    click HTTP "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/HttpTrigger1/__init__.py"
    click HTTP "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/HttpTrigger1/function.json"
    click HTTP "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/HttpTrigger1/sample.dat"
    click AppConfig "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/HttpTrigger1/__init__.py"
    click AppConfig "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/requirements.txt"
    click Logging "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/host.json"
    click Logging "https://github.com/ciscoise/ciscoise-terraform-automation-azure-functions/blob/main/requirements.txt"

    %% Styles
    classDef trigger fill:#87CEFA,stroke:#000,stroke-width:1px
    classDef compute fill:#98FB98,stroke:#000,stroke-width:1px
    classDef config  fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef monitor fill:#D8BFD8,stroke:#000,stroke-width:1px
```
