Commit 31fd9c06 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Add QKD tests to device

parent 573844e1
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
            "device_id": {"device_uuid": {"uuid": "QKD1"}}, "device_type": "qkd-node",
            "device_operational_status": 0, "device_drivers": [12], "device_endpoints": [],
            "device_config": {"config_rules": [
                {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.211.36.220"}},
                {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.10"}},
                {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "11111"}},
                {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {
                    "scheme": "http"
@@ -22,7 +22,7 @@
            "device_id": {"device_uuid": {"uuid": "QKD2"}}, "device_type": "qkd-node",
            "device_operational_status": 0, "device_drivers": [12], "device_endpoints": [],
            "device_config": {"config_rules": [
                {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.211.36.220"}},
                {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.10"}},
                {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "22222"}},
                {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {
                    "scheme": "http"
@@ -34,7 +34,7 @@
            "device_id": {"device_uuid": {"uuid": "QKD3"}}, "device_type": "qkd-node",
            "device_operational_status": 0, "device_drivers": [12], "device_endpoints": [],
            "device_config": {"config_rules": [
                {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.211.36.220"}},
                {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.10"}},
                {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "33333"}},
                {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {
                    "scheme": "http"
@@ -45,31 +45,31 @@
    ],
    "links": [
	{
            "link_id": {"link_uuid": {"uuid": "QKD1/10.211.36.220:1001==QKD2/10.211.36.220:2001"}},
            "link_id": {"link_uuid": {"uuid": "QKD1/10.0.2.10:1001==QKD2/10.0.2.10:2001"}},
            "link_endpoint_ids": [
                {"device_id": {"device_uuid": {"uuid": "QKD1"}}, "endpoint_uuid": {"uuid": "10.211.36.220:1001"}},
                {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.211.36.220:2001"}}
                {"device_id": {"device_uuid": {"uuid": "QKD1"}}, "endpoint_uuid": {"uuid": "10.0.2.10:1001"}},
                {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2001"}}
            ]
        },
        {
            "link_id": {"link_uuid": {"uuid": "QKD2/10.211.36.220:2001==QKD1/10.211.36.220:1001"}},
            "link_id": {"link_uuid": {"uuid": "QKD2/10.0.2.10:2001==QKD1/10.0.2.10:1001"}},
            "link_endpoint_ids": [
		{"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.211.36.220:2001"}},
                {"device_id": {"device_uuid": {"uuid": "QKD1"}}, "endpoint_uuid": {"uuid": "10.211.36.220:1001"}}
		        {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2001"}},
                {"device_id": {"device_uuid": {"uuid": "QKD1"}}, "endpoint_uuid": {"uuid": "10.0.2.10:1001"}}
            ]
        },
	{
            "link_id": {"link_uuid": {"uuid": "QKD2/10.211.36.220:2002==QKD3/10.211.36.220:3001"}},
            "link_id": {"link_uuid": {"uuid": "QKD2/10.0.2.10:2002==QKD3/10.0.2.10:3001"}},
            "link_endpoint_ids": [
		{"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.211.36.220:2002"}},
                {"device_id": {"device_uuid": {"uuid": "QKD3"}}, "endpoint_uuid": {"uuid": "10.211.36.220:3001"}}
		        {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2002"}},
                {"device_id": {"device_uuid": {"uuid": "QKD3"}}, "endpoint_uuid": {"uuid": "10.0.2.10:3001"}}
            ]
        },
	{
            "link_id": {"link_uuid": {"uuid": "QKD3/10.211.36.220:3001==QKD2/10.211.36.220:2002"}},
            "link_id": {"link_uuid": {"uuid": "QKD3/10.0.2.10:3001==QKD2/10.0.2.10:2002"}},
            "link_endpoint_ids": [
                {"device_id": {"device_uuid": {"uuid": "QKD3"}}, "endpoint_uuid": {"uuid": "10.211.36.220:3001"}},
                {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.211.36.220:2002"}}
                {"device_id": {"device_uuid": {"uuid": "QKD3"}}, "endpoint_uuid": {"uuid": "10.0.2.10:3001"}},
                {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2002"}}
            ]
        }

+3 −1
Original line number Diff line number Diff line
@@ -14,9 +14,11 @@

import pytest
import json
import os
os.environ['DEVICE_EMULATED_ONLY'] = 'YES'
from device.service.drivers.qkd.QKDDriver2 import QKDDriver

MOCK_QKD_ADDRRESS = '127.0.0.1'
MOCK_QKD_ADDRRESS = '10.0.2.10'
MOCK_PORT = 11111

@pytest.fixture
+26 −0
Original line number Diff line number Diff line
import requests

QKD_ADDRESS = '10.0.2.10'
QKD_URL     = 'http://{:s}/qkd_app/create_qkd_app'.format(QKD_ADDRESS)

QKD_REQUEST_1 = {
    'app': {
        'server_app_id': '1',
        'client_app_id': [],
        'app_status': 'ON',
        'local_qkdn_id': '00000001-0000-0000-0000-0000000000',
        'backing_qkdl_id': ['00000003-0002-0000-0000-0000000000']
    }
}
print(requests.post(QKD_URL, json=QKD_REQUEST_1))

QKD_REQUEST_2 = {
    'app': {
        'server_app_id': '1',
        'client_app_id': [],
        'app_status': 'ON',
        'local_qkdn_id': '00000003-0000-0000-0000-0000000000',
        'backing_qkdl_id': ['00000003-0002-0000-0000-0000000000']
    }
}
print(requests.post(QKD_URL, json=QKD_REQUEST_2))