X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO%2Fosm_ro%2Fwim%2Ffailing_connector.py;fp=RO%2Fosm_ro%2Fwim%2Ffailing_connector.py;h=0000000000000000000000000000000000000000;hb=7277486065c905f91477bb064da86855a8fa269a;hp=6bbab3574092ae6abb629a1d25196cf2d5da1bd2;hpb=667d158c0d3ee7b4c176ad0b27ac428c81b0ddbc;p=osm%2FRO.git diff --git a/RO/osm_ro/wim/failing_connector.py b/RO/osm_ro/wim/failing_connector.py deleted file mode 100644 index 6bbab357..00000000 --- a/RO/osm_ro/wim/failing_connector.py +++ /dev/null @@ -1,88 +0,0 @@ -# -*- coding: utf-8 -*- -## -# Copyright 2018 University of Bristol - High Performance Networks Research -# Group -# All Rights Reserved. -# -# Contributors: Anderson Bravalheri, Dimitrios Gkounis, Abubakar Siddique -# Muqaddas, Navdeep Uniyal, Reza Nejabati and Dimitra Simeonidou -# -# 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. -# -# For those usages not covered by the Apache License, Version 2.0 please -# contact with: -# -# Neither the name of the University of Bristol nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# This work has been performed in the context of DCMS UK 5G Testbeds -# & Trials Programme and in the framework of the Metro-Haul project - -# funded by the European Commission under Grant number 761727 through the -# Horizon 2020 and 5G-PPP programmes. -## - -"""In the case any error happens when trying to initiate the WIM Connector, -we need a replacement for it, that will throw an error every time we try to -execute any action -""" -import json -from .sdnconn import SdnConnectorError - - -class FailingConnector(object): - """Placeholder for a connector whose incitation failed, - This place holder will just raise an error every time an action is needed - from the connector. - - This way we can make sure that all the other parts of the program will work - but the user will have all the information available to fix the problem. - """ - def __init__(self, error_msg): - self.error_msg = error_msg - - def __call__(self, wim, wim_account, config=None, logger=None): - return self - - def vimconnector(self, *args, **kwargs): - raise Exception(self.error_msg) - - def check_credentials(self): - raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg) - - def get_connectivity_service_status(self, service_uuid, _conn_info=None): - raise SdnConnectorError('Impossible to retrieve status for {}\n\n{}' - .format(service_uuid, self.error_msg)) - - def create_connectivity_service(self, service_uuid, *args, **kwargs): - raise SdnConnectorError('Impossible to connect {}.\n{}\n{}\n{}' - .format(service_uuid, self.error_msg, - json.dumps(args, indent=4), - json.dumps(kwargs, indent=4))) - - def delete_connectivity_service(self, service_uuid, _conn_info=None): - raise SdnConnectorError('Impossible to disconnect {}\n\n{}' - .format(service_uuid, self.error_msg)) - - def edit_connectivity_service(self, service_uuid, *args, **kwargs): - raise SdnConnectorError('Impossible to change connection {}.\n{}\n' - '{}\n{}' - .format(service_uuid, self.error_msg, - json.dumps(args, indent=4), - json.dumps(kwargs, indent=4))) - - def clear_all_connectivity_services(self): - raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg) - - def get_all_active_connectivity_services(self): - raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg)