Skip to content
Snippets Groups Projects
Commit 6da99c19 authored by Shayan Hajipour's avatar Shayan Hajipour
Browse files

debug:

- request temporarily commented for tests in ietf_slice driver's connect method
- ietf slice url's updated in tfs_slice-nbi_client.py
parent f8d22900
No related branches found
No related tags found
2 merge requests!359Release TeraFlowSDN 5.0,!305Resolve "(CTTC) Driver required to interact with IETF Slice Compliant Controller"
......@@ -142,7 +142,8 @@ class IetfSliceDriver(_Driver):
if self.__started.is_set():
return True
try:
requests.get(url, timeout=self.__timeout)
# requests.get(url, timeout=self.__timeout)
...
except requests.exceptions.Timeout:
LOGGER.exception("Timeout connecting {:s}".format(url))
return False
......@@ -243,6 +244,7 @@ class IetfSliceDriver(_Driver):
self.tac.delete_slice(slice_name)
results.append((resource_key, True))
except Exception as e: # pylint: disable=broad-except
raise e
LOGGER.exception(
"Unhandled error processing resource_key({:s})".format(
str(resource_key)
......
......@@ -18,11 +18,13 @@ from typing import Optional
import requests
from requests.auth import HTTPBasicAuth
IETF_SLICE_URL = "{:s}://{:s}:{:d}/restconf/data/ietf-network-slice-service:ietf-nss"
IETF_SLICE_URL = "{:s}://{:s}:{:d}/restconf/data/ietf-network-slice-service"
TIMEOUT = 30
LOGGER = logging.getLogger(__name__)
HEADERS = {'Content-Type': 'application/json'}
class TfsApiClient:
def __init__(
......@@ -42,9 +44,9 @@ class TfsApiClient:
# )
def create_slice(self, slice_data: dict) -> None:
url = self._slice_url + "/network-slice-services"
url = self._slice_url + ":network-slice-services"
try:
requests.post(url, json=slice_data)
requests.post(url, json=slice_data, headers=HEADERS)
except requests.exceptions.ConnectionError:
raise Exception("faild to send post request to TFS IETF Slice NBI")
......@@ -56,10 +58,10 @@ class TfsApiClient:
) -> None:
url = (
self._slice_url
+ f"/network-slice-services/slice-service={slice_name}/connection-groups/connection-group={connection_group_id}"
+ f":network-slice-services/slice-service={slice_name}/connection-groups/connection-group={connection_group_id}"
)
try:
requests.put(url, json=updated_connection_group_data)
requests.put(url, json=updated_connection_group_data, headers=HEADERS)
except requests.exceptions.ConnectionError:
raise Exception("faild to send update request to TFS IETF Slice NBI")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment