This is the same chart I created in Lucid charts, re-implemented in Mermaid, incase that is easier for gitlab users to edit. (I don't find mermaid that intuitive, but maybe you do?)
I was hoping to end up with a flowchart suitable to include in the documentation, ideally one we could maintain the source to in Gitlab and rebuild as needed. I am afraid unless someone has better Mermaid-foo, I don't think we have enough control over the layout of the subgraphs to make this readable. In that case, once the flow is correct, I will re-draw this in some other format that gives more control over the appearance.
graph TB;
subgraph "Subnet Selection"
Node10[[Iterate through subnets <br> in insertion order, <br> checking for first match with: <br> incoming interface <br> ciaddr, client address <br> giaddr, gateway address <br> local address <br> remote address]] --> Node11
Node5 -- No, add options from HR --> Node10
Node11[Subnet match] --> Node12{Evaluate client classes?}
Node12 -- Yes --> Node13
Node12 -- No --> Node14
Node13{Is client class allowed in this subnet?} -- Yes --> Node14
Node13 -- No --> Node10
Node14{check for host reservation in subnet?} -- Yes --> Node15
Node14 -- No --> Node16
Node15[(Check for Host Reservation, <br> evaluating Mac address and ciaddr)] -- Reservation, <br> add class=known <br> add options from HR --> Node17
Node15 -- No reservation --> Node16
end
subgraph "Address Assignment"
Node16((Subnet Selected)) --> Node20
Node20(Iterate through pools <br> in order configured) --> Node21
Node21[Next Address] --> Node22
Node21 -- Pool exhausted --> Node20
Node22[(Check lease DB)] -- Address available --> Node23((Address Selected))
Node22 -- active or expired lease <br> address unavailable --> Node21
Node22 -- address is reserved <br> address unavailable --> Node21
Node23 ==> Node30
end
subgraph "Option Selection"
Node17((Address Selected)) --> Node23
Node30{Is this a host reservation?} -- Yes --> Node31[Add options associated <br> HR and class = known]
Node31 --> Node32[Add any additional options <br> associated with client class]
Node30 -- No --> Node32
Node32 --> Node33[Add any additional options <br> defined in pool]
Node33 --> Node34[Add any additional options <br> defined in subnet]
Node34 --> Node35[Add any additional options <br> defined in shared subnet]
Node35 --> Node36[Add global options]
Node36 --> Node37((Options assigned)) --> Node7
end
subgraph "Client Request"
Node1[Request for new lease] --> Node2{Bypass global HR check?}
Node2 -- Default --> Node3[(Check for global HR)]
Node2 -- Yes, reservation mode: disabled --> Node10
Node3 -- Global HR found --> Node4[Host Reservation <br>add class=known <br> add options from HR]
Node3 -- No reservation --> Node10
Node4 --> Node5{Does HR include an address?}
Node5 -- Yes, address provided --> Node17
Node5 ==> Node7[(Write lease to lease db)] ==> Node8([Respond to client <br> confirming lease])
end