import requests
import warnings
warnings.filterwarnings("ignore", message="Unverified HTTPS request")

# API endpoint
api_url = 'https://3.143.25.10/nokia-altiplano-ac/rest/restconf/data/ibn:ibn?altiplano-trigger'

# JSON payload
payload = {
    "ibn:intent": {
        "intent-specific-data": {
            "ont:ont": {
                "ont-type": "G040PQ_v2",
                "auto": [None],
                "from-device-mapping": [None],
                "onu-service-profile": "default",
                "pon-type": "gpon",
                "expected-serial-number": "ALCLB25FCDF5",
                "uni-service-configuration": [
                    {
                        "service-profile": "default",
                        "uni-id": "LAN1"
                    }
                ],
                "fiber-name": "rlo1-p5"
            }
        },
        "intent-type": "ont",
        "target": "Concordia_CAGE1",
        "required-network-state": "active",
        "intent-type-version": 6
    }
}

# Make POST request
try:
    response = requests.post(api_url, json=payload, verify=False)
    response.raise_for_status()  # Raise an exception for 4xx or 5xx errors

    # Print response
    print("Response from API:")
    print(response.json())

except requests.exceptions.RequestException as e:
    print("Error:", e)

