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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SETUP_PROMPT= """
|
| 2 |
+
You are a Senior Network Architect.
|
| 3 |
+
Your task is to transform natural language network requirements into a fully specified network topology.
|
| 4 |
+
You will generate a network topology layer by layer (Core, Distribution, Access, Endpoint).
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
THINKING PROCESS (STRICT EXECUTION ORDER):
|
| 8 |
+
You MUST follow the steps in order. Each step must be completed before the next begins.
|
| 9 |
+
|
| 10 |
+
STEP 1: Generate 3 different valid candidate topologies satisfying all user requirements.
|
| 11 |
+
|
| 12 |
+
For each candidate topology:
|
| 13 |
+
- ensure no isolated nodes (every device is connected)
|
| 14 |
+
- minimize single points of failure
|
| 15 |
+
- maximize redundant paths between sites and key devices
|
| 16 |
+
- maximize path diversity
|
| 17 |
+
|
| 18 |
+
Select topology using strict priority order:
|
| 19 |
+
1) fewer single points of failure
|
| 20 |
+
2) higher redundant paths
|
| 21 |
+
3) higher path diversity
|
| 22 |
+
|
| 23 |
+
If tie, select arbitrarily among best candidates.
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
STEP 2: Validate selected topology:
|
| 27 |
+
- simulate single link failure
|
| 28 |
+
- simulate single device failure
|
| 29 |
+
|
| 30 |
+
If any required connectivity is broken → return to Step 1
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
OUTPUT_FORMAT_PROMPT_STAGE_1 = """
|
| 36 |
+
*OUTPUT RULES:
|
| 37 |
+
- Return ONLY valid JSON
|
| 38 |
+
- No explanations, comments, or text outside the JSON
|
| 39 |
+
- Ensure correct syntax (no missing commas, brackets, or quotes)
|
| 40 |
+
- No trailing commas
|
| 41 |
+
|
| 42 |
+
*DEVICE INTERFACES GUIDELINES:
|
| 43 |
+
- "used_interfaces" should list all interfaces that are connected to other devices
|
| 44 |
+
- "unused_interfaces" should list all interfaces that are not connected to other devices
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
Rules (STRICT - ZERO TOLERANCE):
|
| 48 |
+
- Every physical connection between two CORE devices MUST be represented from both sides in the JSON.
|
| 49 |
+
- Each physical interface can be connected to ONLY one peer device/interface.
|
| 50 |
+
- If device A connects to device B, then:
|
| 51 |
+
- A.used_interfaces must include the connection to B
|
| 52 |
+
- B.used_interfaces must include the reciprocal connection to A
|
| 53 |
+
- This reciprocal rule applies ONLY to connections between CORE devices.
|
| 54 |
+
|
| 55 |
+
*OUTPUT FORMAT:
|
| 56 |
+
{
|
| 57 |
+
"network_topology": {
|
| 58 |
+
"devices": [
|
| 59 |
+
{
|
| 60 |
+
"device_name": "<NODE_NAME>",
|
| 61 |
+
"device_type": "<NODE_TYPE>",
|
| 62 |
+
"network_layer": "Core",
|
| 63 |
+
"location_site": "<SITE>",
|
| 64 |
+
"device_interfaces": {
|
| 65 |
+
"used_interfaces": [
|
| 66 |
+
{
|
| 67 |
+
"interface_name": "<INTERFACE_NAME>",
|
| 68 |
+
"interface_type": "<INTERFACE_TYPE>",
|
| 69 |
+
"peer_connection": {
|
| 70 |
+
"peer_device": "<PEER_DEVICE_NAME>",
|
| 71 |
+
"peer_interface": "<PEER_INTERFACE_NAME>",
|
| 72 |
+
"peer_interface_type": "<PEER_INTERFACE_TYPE>"
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
],
|
| 76 |
+
"unused_interfaces": ["<UNUSED_INTERFACE_NAME_1>", "<UNUSED_INTERFACE_NAME_2>", "..."]
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
]
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
OUTPUT_FORMAT_PROMPT_STAGE_2 = """
|
| 86 |
+
*OUTPUT RULES:
|
| 87 |
+
- Return ONLY valid JSON
|
| 88 |
+
- No explanations, comments, or text outside the JSON
|
| 89 |
+
- Ensure correct syntax (no missing commas, brackets, or quotes)
|
| 90 |
+
- No trailing commas
|
| 91 |
+
|
| 92 |
+
*DEVICE INTERFACES GUIDELINES:
|
| 93 |
+
- "used_interfaces" should list all interfaces that are connected to other devices
|
| 94 |
+
- "unused_interfaces" should list all interfaces that are not connected to other devices
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
Rules (STRICT - ZERO TOLERANCE):
|
| 98 |
+
- Every physical connection between two DISTRIBUTION devices MUST be represented from both sides in the JSON.
|
| 99 |
+
- Each physical interface can be connected to ONLY one peer device/interface.
|
| 100 |
+
- If device A connects to device B, then:
|
| 101 |
+
- A.used_interfaces must include the connection to B
|
| 102 |
+
- B.used_interfaces must include the reciprocal connection to A
|
| 103 |
+
- This reciprocal rule applies ONLY to connections between DISTRIBUTION devices.
|
| 104 |
+
|
| 105 |
+
*OUTPUT FORMAT:
|
| 106 |
+
{
|
| 107 |
+
"network_topology": {
|
| 108 |
+
"devices": [
|
| 109 |
+
{
|
| 110 |
+
"device_name": "<NODE_NAME>",
|
| 111 |
+
"device_type": "<NODE_TYPE>",
|
| 112 |
+
"network_layer": "Distribution",
|
| 113 |
+
"location_site": "<SITE>",
|
| 114 |
+
"device_interfaces": {
|
| 115 |
+
"used_interfaces": [
|
| 116 |
+
{
|
| 117 |
+
"interface_name": "<INTERFACE_NAME>",
|
| 118 |
+
"interface_type": "<INTERFACE_TYPE>",
|
| 119 |
+
"peer_connection": {
|
| 120 |
+
"peer_device": "<PEER_DEVICE_NAME>",
|
| 121 |
+
"peer_interface": "<PEER_INTERFACE_NAME>",
|
| 122 |
+
"peer_interface_type": "<PEER_INTERFACE_TYPE>"
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
],
|
| 126 |
+
"unused_interfaces": ["<UNUSED_INTERFACE_NAME_1>", "<UNUSED_INTERFACE_NAME_2>", "..."]
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
]
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
"""
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
OUTPUT_FORMAT_PROMPT_STAGE_3 = """
|
| 136 |
+
*OUTPUT RULES:
|
| 137 |
+
- Return ONLY valid JSON
|
| 138 |
+
- No explanations, comments, or text outside the JSON
|
| 139 |
+
- Ensure correct syntax (no missing commas, brackets, or quotes)
|
| 140 |
+
- No trailing commas
|
| 141 |
+
|
| 142 |
+
*DEVICE INTERFACES GUIDELINES:
|
| 143 |
+
- "used_interfaces" should list all interfaces that are connected to other devices
|
| 144 |
+
- "unused_interfaces" should list all interfaces that are not connected to other devices
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
Rules (STRICT - ZERO TOLERANCE):
|
| 148 |
+
- Every physical connection between two ACCESS devices MUST be represented from both sides in the JSON.
|
| 149 |
+
- Each physical interface can be connected to ONLY one peer device/interface.
|
| 150 |
+
- If device A connects to device B, then:
|
| 151 |
+
- A.used_interfaces must include the connection to B
|
| 152 |
+
- B.used_interfaces must include the reciprocal connection to A
|
| 153 |
+
- This reciprocal rule applies ONLY to connections between ACCESS devices.
|
| 154 |
+
|
| 155 |
+
*OUTPUT FORMAT:{
|
| 156 |
+
"network_topology": {
|
| 157 |
+
"devices": [
|
| 158 |
+
{
|
| 159 |
+
"device_name": "<NODE_NAME>",
|
| 160 |
+
"device_type": "<NODE_TYPE>",
|
| 161 |
+
"network_layer": "Access",
|
| 162 |
+
"location_site": "<SITE>",
|
| 163 |
+
"device_interfaces": {
|
| 164 |
+
"used_interfaces": [
|
| 165 |
+
{
|
| 166 |
+
"interface_name": "<INTERFACE_NAME>",
|
| 167 |
+
"interface_type": "<INTERFACE_TYPE>",
|
| 168 |
+
"peer_connection": {
|
| 169 |
+
"peer_device": "<PEER_DEVICE_NAME>",
|
| 170 |
+
"peer_interface": "<PEER_INTERFACE_NAME>",
|
| 171 |
+
"peer_interface_type": "<PEER_INTERFACE_TYPE>"
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
],
|
| 175 |
+
"unused_interfaces": ["<UNUSED_INTERFACE_NAME_1>", "<UNUSED_INTERFACE_NAME_2>", "..."]
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
]
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
"""
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
OUTPUT_FORMAT_PROMPT_STAGE_4 = """
|
| 185 |
+
*OUTPUT RULES:
|
| 186 |
+
- Return ONLY valid JSON
|
| 187 |
+
- No explanations, comments, or text outside the JSON
|
| 188 |
+
- Ensure correct syntax (no missing commas, brackets, or quotes)
|
| 189 |
+
- No trailing commas
|
| 190 |
+
|
| 191 |
+
*DEVICE INTERFACES GUIDELINES:
|
| 192 |
+
- "used_interfaces" should list all interfaces that are connected to other devices
|
| 193 |
+
- "unused_interfaces" should list all interfaces that are not connected to other devices
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
Rules (STRICT - ZERO TOLERANCE):
|
| 197 |
+
- Every physical connection between two ENDPOINT devices MUST be represented from both sides in the JSON.
|
| 198 |
+
- Each physical interface can be connected to ONLY one peer device/interface.
|
| 199 |
+
- If device A connects to device B, then:
|
| 200 |
+
- A.used_interfaces must include the connection to B
|
| 201 |
+
- B.used_interfaces must include the reciprocal connection to A
|
| 202 |
+
- This reciprocal rule applies ONLY to connections between ENDPOINT devices.
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
*OUTPUT FORMAT:
|
| 206 |
+
{
|
| 207 |
+
"network_topology": {
|
| 208 |
+
"devices": [
|
| 209 |
+
{
|
| 210 |
+
"device_name": "<NODE_NAME>",
|
| 211 |
+
"device_type": "<NODE_TYPE>",
|
| 212 |
+
"network_layer": "Endpoint",
|
| 213 |
+
"location_site": "<SITE>",
|
| 214 |
+
"device_interfaces": {
|
| 215 |
+
"used_interfaces": [
|
| 216 |
+
{
|
| 217 |
+
"interface_name": "<INTERFACE_NAME>",
|
| 218 |
+
"interface_type": "<INTERFACE_TYPE>",
|
| 219 |
+
"peer_connection": {
|
| 220 |
+
"peer_device": "<PEER_DEVICE_NAME>",
|
| 221 |
+
"peer_interface": "<PEER_INTERFACE_NAME>",
|
| 222 |
+
"peer_interface_type": "<PEER_INTERFACE_TYPE>"
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
],
|
| 226 |
+
"unused_interfaces": ["<UNUSED_INTERFACE_NAME_1>", "<UNUSED_INTERFACE_NAME_2>", "..."]
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
]
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
"""
|