# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
from flask import jsonify
import requests

logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger()
BASE_URL = 'http://10.1.7.197/camara/qod/v0'
def test_create_SESSION():
    BASE_URL = 'http://10.1.7.197/camara/qod/v0'
    service_data={  
    "device":
        {"ipv4Address":"84.75.11.12/25" },
    "applicationServer": {
        "ipv4Address": "192.168.0.1/26",
        },
  "duration":10000000.00,
  "qos_profile_id": "367d3e3f-96be-4391-af82-e21c042dd9bd",
     }
    post_response = requests.post(f'{BASE_URL}/sessions', json=service_data).json()
    #id=post_response['sessionID']
    #get_response = requests.get(f'{BASE_URL}/sessions/{id}').json()
    get_response = requests.get(f'{BASE_URL}/sessions').json()


#def test_delete_session_by_id():
#    session_id = '' 
#    response = requests.delete(f'{BASE_URL}/sessions/{session_id}')

#def test_update_session_by_id():
#    session_id='3ac2ff12-d763-4ded-9e13-7e82709b16cd'
#    session_data={"session_id":'3ac2ff12-d763-4ded-9e13-7e82709b16cd',
#                   "device":
#                   {"ipv4Address":"84.75.11.12/25" },
#                       "applicationServer": {
#                   "ipv4Address": "192.168.0.1/26",
#                    },
#                   "duration":2000000000.00,
#                   "qos_profile_id": "28499a15-c1d9-428c-9732-82859a727235"}
#    put_response=requests.put(f'{BASE_URL}/sessions/{session_id}',json=session_data).json()