-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
1,161 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[report] | ||
omit = | ||
*__init__* | ||
*bp_exception* | ||
*exceptions* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
language: python | ||
python: | ||
- '2.7' | ||
- '2.7' | ||
|
||
before_install: | ||
- pip install coveralls | ||
- pip install -r test_requirements.txt --extra-index-url https://testpypi.python.org/pypi | ||
|
||
install: | ||
- pip install -r requirements.txt --extra-index-url https://testpypi.python.org/pypi | ||
- 'if [ ${TRAVIS_BRANCH} \!= "master" ] && [ -f dev_requirements.txt ]; then | ||
pip install --extra-index-url https://testpypi.python.org/pypi -r dev_requirements.txt; | ||
python setup.py develop --no-deps; | ||
else | ||
python setup.py install; | ||
fi' | ||
- pip install -r test_requirements.txt | ||
- pip install coveralls | ||
|
||
script: | ||
- python setup.py install | ||
- nosetests --with-coverage --cover-package=cloudshell/tg/breaking_point --ignore-files='.*bp_exception\.py' --ignore-files='.*exceptions\.py' | ||
- nosetests --with-coverage --cover-package=cloudshell.tg.breaking_point tests | ||
|
||
after_success: | ||
- coveralls | ||
- coveralls |
47 changes: 0 additions & 47 deletions
47
cloudshell/tests/tg/breaking_point/helpers/test_context_utils.py
This file was deleted.
Oops, something went wrong.
114 changes: 0 additions & 114 deletions
114
cloudshell/tests/tg/breaking_point/runners/test_bp_runner.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from pkgutil import extend_path | ||
__path__ = extend_path(__path__, __name__) | ||
|
||
__path__ = extend_path(__path__, __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from pkgutil import extend_path | ||
__path__ = extend_path(__path__, __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from cloudshell.tg.breaking_point.rest_actions.rest_actions import RestActions | ||
|
||
|
||
class AutoloadActions(RestActions): | ||
def get_ports_info(self): | ||
self._logger.debug('Ports info request') | ||
uri = '/api/v1/bps/ports' | ||
data = self._rest_service.request_get(uri) | ||
result = data.get('portReservationState') | ||
return result |
41 changes: 41 additions & 0 deletions
41
cloudshell/tg/breaking_point/actions/port_reservation_actions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from cloudshell.tg.breaking_point.rest_api.rest_json_client import RestJsonClient | ||
|
||
|
||
class PortReservationActions(object): | ||
def __init__(self, rest_service, logger): | ||
""" | ||
Reboot actions | ||
:param rest_service: | ||
:type rest_service: RestJsonClient | ||
:param logger: | ||
:type logger: Logger | ||
:return: | ||
""" | ||
self._rest_service = rest_service | ||
self._logger = logger | ||
|
||
def port_status(self): | ||
uri = '/api/v1/bps/ports' | ||
data = self._rest_service.request_get(uri) | ||
result = data.get('portReservationState') | ||
self._logger.debug('Port status {}'.format(result)) | ||
return result | ||
|
||
def reserve_port(self, slot, port_list, group): | ||
self._logger.debug('Reserving ports {0} on slot {1} for group {2}'.format(port_list, slot, group)) | ||
uri = '/api/v1/bps/ports/operations/reserve' | ||
json_data = {"slot": slot, "portList": port_list, "group": group, "force": "true"} | ||
self._logger.info(json_data) | ||
data = self._rest_service.request_post(uri, json_data) | ||
result = data | ||
self._logger.debug(str(result)) | ||
return result | ||
|
||
def unreserve_port(self, slot, port_list): | ||
self._logger.debug('Unreserving ports {0} on slot {1}'.format(port_list, slot)) | ||
uri = '/api/v1/bps/ports/operations/unreserve' | ||
json_data = {"slot": slot, "portList": port_list} | ||
data = self._rest_service.request_post(uri, json_data) | ||
result = data | ||
self._logger.debug(str(result)) | ||
return result |
75 changes: 75 additions & 0 deletions
75
cloudshell/tg/breaking_point/actions/test_configuration_actions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from cloudshell.tg.breaking_point.rest_api.rest_json_client import RestJsonClient | ||
from os.path import basename | ||
|
||
|
||
class TestConfigurationActions(object): | ||
def __init__(self, rest_service, logger): | ||
""" | ||
Reboot actions | ||
:param rest_service: | ||
:type rest_service: RestJsonClient | ||
:param logger: | ||
:type logger: Logger | ||
:return: | ||
""" | ||
self._rest_service = rest_service | ||
self._logger = logger | ||
|
||
def import_test(self, test_file_path): | ||
""" | ||
Upload test file to the BP controller | ||
:param test_name: | ||
:type test_name: str | ||
:param test_file: | ||
:type test_file: file | ||
:return: | ||
""" | ||
self._logger.debug('Importing test {}'.format(test_file_path)) | ||
uri = '/api/v1/bps/upload' | ||
json_data = {'force': True} | ||
file_name = basename(test_file_path) | ||
files = {'file': (file_name, open(test_file_path, 'rb'))} | ||
data = self._rest_service.request_post_files(uri, json_data, files) | ||
result = data | ||
return result | ||
|
||
def import_pcap(self, pcap_file_path): | ||
""" | ||
Upload test file to the BP controller | ||
:param test_name: | ||
:type test_name: str | ||
:param test_file: | ||
:type test_file: file | ||
:return: | ||
""" | ||
self._logger.debug('Importing test {}'.format(pcap_file_path)) | ||
uri = '/api/v1/bps/upload/capture' | ||
json_data = {'force': True} | ||
file_name = basename(pcap_file_path) | ||
files = {'file': (file_name, open(pcap_file_path, 'rb'), "multipart/form-data")} | ||
data = self._rest_service.request_post_files(uri, json_data, files) | ||
result = data | ||
return result | ||
|
||
def export_test(self, test_name): | ||
self._logger.debug('Exporting test {0}'.format(test_name)) | ||
uri = '/api/v1/bps/export/bpt/testname/' + test_name | ||
data = self._rest_service.request_get_files(uri) | ||
result = data.content | ||
return result | ||
|
||
def reserve_port(self, slot, port_list): | ||
self._logger.debug('Reserving ports {0} on slot {1}'.format(port_list, slot)) | ||
uri = '/api/v1/bps/ports/operations/reserve' | ||
json_data = {"slot": slot, "portList": port_list, "group": "1", "force": "true"} | ||
data = self._rest_service.request_post(uri, json_data) | ||
result = data | ||
return result | ||
|
||
def unreserve_port(self, slot, port_list): | ||
self._logger.debug('Unreserving ports {0} on slot {1}'.format(port_list, slot)) | ||
uri = '/api/v1/bps/ports/operations/unreserve' | ||
json_data = {"slot": slot, "portList": port_list} | ||
data = self._rest_service.request_post(uri, json_data) | ||
result = data | ||
return result |
47 changes: 47 additions & 0 deletions
47
cloudshell/tg/breaking_point/actions/test_execution_actions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from cloudshell.tg.breaking_point.rest_actions.exceptions import RestActionsException | ||
from cloudshell.tg.breaking_point.rest_api.rest_json_client import RestJsonClient | ||
|
||
|
||
class TestExecutionActions(object): | ||
def __init__(self, rest_service, logger): | ||
""" | ||
Reboot actions | ||
:param rest_service: | ||
:type rest_service: RestJsonClient | ||
:param logger: | ||
:type logger: Logger | ||
:return: | ||
""" | ||
self._rest_service = rest_service | ||
self._logger = logger | ||
|
||
def start_test(self, test_name, group_id): | ||
self._logger.debug('Starting test {}'.format(test_name)) | ||
uri = 'api/v1/bps/tests/operations/start' | ||
json_data = {"modelname": test_name, "group": group_id} | ||
data = self._rest_service.request_post(uri, json_data) | ||
test_id = data.get('testid') | ||
return test_id | ||
|
||
def stop_test(self, test_id): | ||
self._logger.debug('Stop running, testID {}'.format(test_id)) | ||
uri = '/api/v1/bps/tests/operations/stop' | ||
json_data = {"testid": test_id} | ||
data = self._rest_service.request_post(uri, json_data) | ||
result = data | ||
return result | ||
|
||
def get_test_status(self, test_id): | ||
self._logger.debug('Geting test status, testID {}'.format(test_id)) | ||
uri = '/api/v1/bps/tests/operations/result' | ||
json_request = {'runid': test_id} | ||
data = self._rest_service.request_post(uri, json_request) | ||
result = data.get('result') | ||
return result | ||
|
||
def running_tests(self): | ||
self._logger.debug('Running tests') | ||
uri = '/api/v1/bps/tests' | ||
data = self._rest_service.request_get(uri) | ||
result = data | ||
return result |
Oops, something went wrong.