Commit 466a9ed9 authored by Pablo Armingol's avatar Pablo Armingol
Browse files

Merge branch...

Merge branch 'feat/314-tid-new-service-for-ipowdm-configuration-fron-orchestrator-to-ipowdm-controller' of https://labs.etsi.org/rep/tfs/controller into feat/314-tid-new-service-for-ipowdm-configuration-fron-orchestrator-to-ipowdm-controller
parents 33eb1071 10c85d13
Loading
Loading
Loading
Loading
+16 −73
Original line number Diff line number Diff line
@@ -2,85 +2,28 @@
    "services": [
        {
            "service_id": {
                "context_id": {
                    "context_uuid": {
                        "uuid": "admin"
                    }
                },
                "service_uuid": {
                    "uuid": "8078f62d-91f4-55fa-81dd-de369e414be8"
                }
                "context_id": {"context_uuid": {"uuid": "admin"}},
                "service_uuid": {"uuid": "IPoWDM"}
            },
            "service_type": 12,
            "service_status": {
                "service_status": 1
            },
            "service_status": {"service_status": 1},
            "service_endpoint_ids": [
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "IP1"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "PORT-xe4"
                    }
                },
                {
                    "device_id": {
                        "device_uuid": {
                            "uuid": "IP2"
                        }
                    },
                    "endpoint_uuid": {
                        "uuid": "PORT-xe4"
                    }
                }
                {"device_id": {"device_uuid": {"uuid": "IP1"}},"endpoint_uuid": {"uuid": "PORT-xe4"}},
                {"device_id": {"device_uuid": {"uuid": "IP2"}},"endpoint_uuid": {"uuid": "PORT-xe4"}}
            ],
            "service_constraints": [],
            "service_config": {
                "config_rules": [
                    {
                        "action": 1,
                        "ipowdm": {
            "service_config": {"config_rules": [
                {"action": 1, "ipowdm": {
                    "endpoint_id": {
                                "device_id": {
                                    "device_uuid": {
                                        "uuid": "IP1"
                                    }
                                },
                                "endpoint_uuid": {
                                    "uuid": "PORT-xe4"
                                }
                        "device_id": {"device_uuid": {"uuid": "IP1"}},
                        "endpoint_uuid": {"uuid": "PORT-xe4"}
                    },
                    "rule_set": {
                                "src": [
                                    {
                                        "uuid": "Phoenix-1",
                                        "ip_address": "10.10.1.1",
                                        "ip_mask": "/24",
                                        "vlan_id": 100,
                                        "power": 0,
                                        "frequency": 194700
                                    }
                                ],
                                "dst": [
                                    {
                                        "uuid": "Phoenix-2",
                                        "ip_address": "10.10.2.1",
                                        "ip_mask": "/24",
                                        "vlan_id": 100,
                                        "power": 0,
                                        "frequency": 194700
                                    }
                                ],
                                "bw": 100,
                                "uuid": "95876830-8396-5241-9bbd-7bfa248232e7"
                            }
                        }
                    }
                ]
                        "src"  : [],
                        "dst"  : []
                    }
                }}
            ]}
        }
    ]
}
 No newline at end of file
+3 −15
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ LOGGER = logging.getLogger(__name__)
""" Create and send HTTP request based on a JSON template and provided resource value.
    The JSON template is expected to be in the same directory as this script, named 'lsp.json'."""
def create_request(resource_value):
    LOGGER.info("Creating request lsp for resource_value: %s", resource_value)
    LOGGER.info("Creating request tapi- lsp for resource_value: %s", resource_value)
    try:
        BaseDir = os.path.dirname(os.path.abspath(__file__))
        json_path = os.path.join(BaseDir, 'lsp.json')
@@ -56,7 +56,6 @@ def create_request(resource_value):
        spectrum["frequency-constraint"]["grid-type"] = rule_set["grid_type"]

        tenant = rule_set["tenant_uuid"]
        LOGGER.debug("Entra en DST")

        # dst - end-point
        ep1 = svc["end-point"][1]
@@ -66,25 +65,14 @@ def create_request(resource_value):
        ep1["layer-protocol-qualifier"] = rule_set["layer_protocol_qualifier"]
        ep1["local-id"] = rule_set["dst"]

        url = f"http://11.1.1.101:4901/{tenant}/restconf/data/tapi-common:context/tapi-connectivity:connectivity-context"
        url = f"http://11.1.1.101:4900/{tenant}/restconf/data/tapi-common:context/tapi-connectivity:connectivity-context"
        headers = {
            "Content-Type": "application/json",
            "Accept": "application/json"
        }
        LOGGER.info("Sending POST request to %s with payload: %s", url, json.dumps(template))
        # response = requests.post(url, headers=headers, json=template, timeout=10)

        response = FakeResponse()
        response = requests.post(url, headers=headers, json=template, timeout=10)
        return response

    except (OSError, json.JSONDecodeError, requests.RequestException) as e:
        LOGGER.error("Error creating request: %s", str(e))
class FakeResponse:
    def __init__(self):
        self.ok = True
        self.status_code = 200
        self.text = '{"message": "OK"}'
    def json(self):
        return {"message": "OK"}
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
{% extends 'base.html' %}

{% block content %}
    <h2>ETSI TeraFlowSDN Controller (End-to-End)</h2>
    <h2>ETSI TeraFlowSDN Controller</h2>

    {% for field, message in context_topology_form.errors.items() %}
        <div class="alert alert-dismissible fade show" role="alert">
+1 −1

File changed.

Contains only whitespace changes.