Code Duplication    Length = 13-13 lines in 2 locations

scripts/console/2025.1.0/001_retire_vlans.py 2 locations

@@ 25-37 (lines=13) @@
22
    if res.is_server_error or res.status_code in {424, 404, 400}:
23
        print(f"Error disabling EVC {evc_id}: {res.text}")
24
25
def enable_evc(evc_id):
26
    import httpx
27
    MEF_ELINE_URL = 'http://localhost:8181/api/kytos/mef_eline/v2'
28
    url = f"{MEF_ELINE_URL}/evc/{evc_id}"
29
    data = {
30
        "enabled": True
31
    }
32
    try:
33
        res = httpx.request("PATCH", url, json=data, timeout=30)
34
    except httpx.TimeoutException:
35
        print(f"Timeout while enabling EVC {evc_id}")
36
    if res.is_server_error or res.status_code in {424, 404, 400}:
37
        print(f"Error enabling EVC {evc_id}: {res.text}")
38
39
mef_eline = controller.napps[("kytos", "mef_eline")]
40
of_lldp = controller.napps[('kytos', 'of_lldp')]
@@ 11-23 (lines=13) @@
8
# Modify with VLAN ranges being retired from use
9
RETIRED_VLANS = [[4095, 4095]]
10
11
def disable_evc(evc_id):
12
    import httpx
13
    MEF_ELINE_URL = 'http://localhost:8181/api/kytos/mef_eline/v2'
14
    url = f"{MEF_ELINE_URL}/evc/{evc_id}"
15
    data = {
16
        "enabled": False
17
    }
18
    try:
19
        res = httpx.request("PATCH", url, json=data, timeout=30)
20
    except httpx.TimeoutException:
21
        print(f"Timeout while enabling EVC {evc_id}")
22
    if res.is_server_error or res.status_code in {424, 404, 400}:
23
        print(f"Error disabling EVC {evc_id}: {res.text}")
24
25
def enable_evc(evc_id):
26
    import httpx