From 8c8a28b3eeb9f171b900277b846d4130a91f7749 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 14:00:15 -0400 Subject: [PATCH 01/13] sdx-lc 2.0.0 --- .github/workflows/test.yml | 4 +- README.md | 30 +- docs/Connection.md | 14 + docs/ConnectionApi.md | 14 +- docs/Link.md | 2 +- docs/LinkApi.md | 24 +- docs/Location.md | 1 + docs/NodeApi.md | 8 +- docs/Port.md | 1 + docs/Service.md | 2 + docs/Topology.md | 5 +- docs/TopologyApi.md | 58 +-- docs/UserApi.md | 2 +- requirements.txt | 1 - setup.py | 2 +- swagger_client/__init__.py | 4 +- swagger_client/api/connection_api.py | 26 +- swagger_client/api/link_api.py | 30 +- swagger_client/api/node_api.py | 26 +- swagger_client/api/topology_api.py | 60 ++- swagger_client/api/user_api.py | 34 +- swagger_client/api_client.py | 2 +- swagger_client/configuration.py | 37 +- swagger_client/models/__init__.py | 2 +- swagger_client/models/api_response.py | 10 +- swagger_client/models/connection.py | 395 +++++++++++++++++- swagger_client/models/link.py | 40 +- .../models/link_measurement_period.py | 10 +- swagger_client/models/location.py | 46 +- swagger_client/models/node.py | 10 +- swagger_client/models/port.py | 37 +- swagger_client/models/service.py | 64 ++- swagger_client/models/topology.py | 99 +++-- swagger_client/models/user.py | 10 +- swagger_client/rest.py | 20 +- test-requirements.txt | 5 +- test/__init__.py | 1 + test/test_api_response.py | 2 +- test/test_connection.py | 2 +- test/test_connection_api.py | 31 +- test/test_link.py | 2 +- test/test_link_api.py | 2 +- test/test_link_measurement_period.py | 7 +- test/test_location.py | 2 +- test/test_node.py | 2 +- test/test_node_api.py | 29 +- test/test_port.py | 2 +- test/test_service.py | 2 +- test/test_topology.py | 2 +- test/test_topology_api.py | 44 +- test/test_user.py | 2 +- test/test_user_api.py | 2 +- tox.ini | 11 +- 53 files changed, 836 insertions(+), 444 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 029a802..02e7563 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -75,7 +75,7 @@ jobs: SDX_MQ_IP: 'localhost' SDXLC_HOST: 'localhost' SDXLC_PORT: '8080' - SDXLC_VERSION: '1.0.0' + SDXLC_VERSION: '2.0.0' SDXLC_NAME: 'lc2' MQ_NAME: 'hello' MQ_HOST: 'localhost' @@ -91,7 +91,7 @@ jobs: env: SDXLC_HOST: 'localhost' SDXLC_PORT: '8080' - SDXLC_VERSION: '1.0.0' + SDXLC_VERSION: '2.0.0' - name: Send coverage data to coveralls.io run: | diff --git a/README.md b/README.md index c996d0e..d7b607c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API version: 1.0.0 +- API version: 2.0.0 - Package version: 1.0.0 - Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen @@ -53,7 +53,7 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.ConnectionApi(swagger_client.ApiClient(configuration)) -connection_id = 789 # int | ID of the connection that needs to be deleted +connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of the connection that needs to be deleted try: # Delete connection order by ID @@ -63,7 +63,7 @@ except ApiException as e: # create an instance of the API class api_instance = swagger_client.ConnectionApi(swagger_client.ApiClient(configuration)) -connection_id = 789 # int | ID of connection that needs to be fetched +connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of connection that needs to be fetched try: # Find connection by ID @@ -86,12 +86,12 @@ except ApiException as e: ## Documentation for API Endpoints -All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/1.0.0* +All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*ConnectionApi* | [**delete_connection**](docs/ConnectionApi.md#delete_connection) | **DELETE** /connection/{connectionId} | Delete connection order by ID -*ConnectionApi* | [**getconnection_by_id**](docs/ConnectionApi.md#getconnection_by_id) | **GET** /connection/{connectionId} | Find connection by ID +*ConnectionApi* | [**delete_connection**](docs/ConnectionApi.md#delete_connection) | **DELETE** /connection/{connection_id} | Delete connection order by ID +*ConnectionApi* | [**getconnection_by_id**](docs/ConnectionApi.md#getconnection_by_id) | **GET** /connection/{connection_id} | Find connection by ID *ConnectionApi* | [**place_connection**](docs/ConnectionApi.md#place_connection) | **POST** /conection | Place an connection request from the SDX-Controller *LinkApi* | [**add_link**](docs/LinkApi.md#add_link) | **POST** /link | add a new link to the topology *LinkApi* | [**delete_link**](docs/LinkApi.md#delete_link) | **DELETE** /link | Deletes a link @@ -108,7 +108,7 @@ Class | Method | HTTP request | Description *TopologyApi* | [**get_topologyby_version**](docs/TopologyApi.md#get_topologyby_version) | **GET** /topology/{version} | Find topology by version *TopologyApi* | [**topology_version**](docs/TopologyApi.md#topology_version) | **GET** /topology/version | Finds topology version *TopologyApi* | [**update_topology**](docs/TopologyApi.md#update_topology) | **PUT** /topology | Update an existing topology -*TopologyApi* | [**upload_file**](docs/TopologyApi.md#upload_file) | **POST** /topology/{topologyId}/uploadImage | uploads an topology image +*TopologyApi* | [**upload_file**](docs/TopologyApi.md#upload_file) | **POST** /topology/{topology_id}/uploadImage | uploads an topology image *UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user *UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array *UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array @@ -133,21 +133,7 @@ Class | Method | HTTP request | Description ## Documentation For Authorization - -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - -## topology_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://0.0.0.0:8080/oauth/dialog -- **Scopes**: - - **write:topology**: modify topology in your account - - **read:topology**: read your topology + All endpoints do not require authorization. ## Author diff --git a/docs/Connection.md b/docs/Connection.md index 185803a..d93d8b6 100644 --- a/docs/Connection.md +++ b/docs/Connection.md @@ -10,6 +10,20 @@ Name | Type | Description | Notes **quantity** | **int** | | [optional] **start_time** | **datetime** | | [optional] **end_time** | **datetime** | | [optional] +**multi_path** | **bool** | | [optional] +**preempt** | **bool** | | [optional] +**backup_path_type** | **str** | | [optional] +**exclusive_links** | [**list[Link]**](Link.md) | | [optional] +**inclusive_links** | [**list[Link]**](Link.md) | | [optional] +**bandwidth_required** | **float** | | [optional] +**bandwidth_measured** | **float** | | [optional] +**latency_required** | **float** | | [optional] +**latency_measured** | **float** | | [optional] +**packetloss_required** | **float** | | [optional] +**packetloss_measured** | **float** | | [optional] +**availability_required** | **float** | | [optional] +**availability_measured** | **float** | | [optional] +**paths** | **list[str]** | | [optional] **status** | **str** | Connection Status | [optional] **complete** | **bool** | | [optional] [default to False] diff --git a/docs/ConnectionApi.md b/docs/ConnectionApi.md index a2673ac..c54e4e3 100644 --- a/docs/ConnectionApi.md +++ b/docs/ConnectionApi.md @@ -1,11 +1,11 @@ # swagger_client.ConnectionApi -All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/1.0.0* +All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* Method | HTTP request | Description ------------- | ------------- | ------------- -[**delete_connection**](ConnectionApi.md#delete_connection) | **DELETE** /connection/{connectionId} | Delete connection order by ID -[**getconnection_by_id**](ConnectionApi.md#getconnection_by_id) | **GET** /connection/{connectionId} | Find connection by ID +[**delete_connection**](ConnectionApi.md#delete_connection) | **DELETE** /connection/{connection_id} | Delete connection order by ID +[**getconnection_by_id**](ConnectionApi.md#getconnection_by_id) | **GET** /connection/{connection_id} | Find connection by ID [**place_connection**](ConnectionApi.md#place_connection) | **POST** /conection | Place an connection request from the SDX-Controller # **delete_connection** @@ -25,7 +25,7 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.ConnectionApi() -connection_id = 789 # int | ID of the connection that needs to be deleted +connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of the connection that needs to be deleted try: # Delete connection order by ID @@ -38,7 +38,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **connection_id** | **int**| ID of the connection that needs to be deleted | + **connection_id** | [**str**](.md)| ID of the connection that needs to be deleted | ### Return type @@ -72,7 +72,7 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.ConnectionApi() -connection_id = 789 # int | ID of connection that needs to be fetched +connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of connection that needs to be fetched try: # Find connection by ID @@ -86,7 +86,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **connection_id** | **int**| ID of connection that needs to be fetched | + **connection_id** | [**str**](.md)| ID of connection that needs to be fetched | ### Return type diff --git a/docs/Link.md b/docs/Link.md index f13c058..b100692 100644 --- a/docs/Link.md +++ b/docs/Link.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **status** | **str** | | [optional] **state** | **str** | | [optional] **private_attributes** | **list[str]** | | [optional] -**time_stamp** | **datetime** | | [optional] +**timestamp** | **datetime** | | [optional] **measurement_period** | [**LinkMeasurementPeriod**](LinkMeasurementPeriod.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/LinkApi.md b/docs/LinkApi.md index cf72609..2f6e5c5 100644 --- a/docs/LinkApi.md +++ b/docs/LinkApi.md @@ -1,6 +1,6 @@ # swagger_client.LinkApi -All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/1.0.0* +All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -22,12 +22,8 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure OAuth2 access token for authorization: topology_auth -configuration = swagger_client.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # create an instance of the API class -api_instance = swagger_client.LinkApi(swagger_client.ApiClient(configuration)) +api_instance = swagger_client.LinkApi() body = swagger_client.Link() # Link | link object that needs to be sent to the SDX LC try: @@ -49,7 +45,7 @@ void (empty response body) ### Authorization -[topology_auth](../README.md#topology_auth) +No authorization required ### HTTP request headers @@ -59,7 +55,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **delete_link** -> delete_link(node_id, api_key=api_key) +> delete_link(node_id) Deletes a link @@ -71,18 +67,13 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure OAuth2 access token for authorization: topology_auth -configuration = swagger_client.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # create an instance of the API class -api_instance = swagger_client.LinkApi(swagger_client.ApiClient(configuration)) +api_instance = swagger_client.LinkApi() node_id = 789 # int | ID of link to delete -api_key = 'api_key_example' # str | (optional) try: # Deletes a link - api_instance.delete_link(node_id, api_key=api_key) + api_instance.delete_link(node_id) except ApiException as e: print("Exception when calling LinkApi->delete_link: %s\n" % e) ``` @@ -92,7 +83,6 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **node_id** | **int**| ID of link to delete | - **api_key** | **str**| | [optional] ### Return type @@ -100,7 +90,7 @@ void (empty response body) ### Authorization -[topology_auth](../README.md#topology_auth) +No authorization required ### HTTP request headers diff --git a/docs/Location.md b/docs/Location.md index b60fd85..5413ec1 100644 --- a/docs/Location.md +++ b/docs/Location.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes **address** | **str** | | [optional] **latitude** | **float** | | [optional] **longitude** | **float** | | [optional] +**iso3166_2_lvl4** | **str** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/NodeApi.md b/docs/NodeApi.md index 99ab4d4..ca9e862 100644 --- a/docs/NodeApi.md +++ b/docs/NodeApi.md @@ -1,6 +1,6 @@ # swagger_client.NodeApi -All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/1.0.0* +All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -56,7 +56,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **delete_node** -> delete_node(node_id, api_key=api_key) +> delete_node(node_id) Deletes a node @@ -71,11 +71,10 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.NodeApi() node_id = 789 # int | ID of node to delete -api_key = 'api_key_example' # str | (optional) try: # Deletes a node - api_instance.delete_node(node_id, api_key=api_key) + api_instance.delete_node(node_id) except ApiException as e: print("Exception when calling NodeApi->delete_node: %s\n" % e) ``` @@ -85,7 +84,6 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **node_id** | **int**| ID of node to delete | - **api_key** | **str**| | [optional] ### Return type diff --git a/docs/Port.md b/docs/Port.md index 58b12be..79c1365 100644 --- a/docs/Port.md +++ b/docs/Port.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **label_range** | **list[str]** | | [optional] **status** | **str** | | **state** | **str** | | [optional] +**services** | [**Service**](Service.md) | | [optional] **private_attributes** | **list[str]** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Service.md b/docs/Service.md index 81efc55..9921f84 100644 --- a/docs/Service.md +++ b/docs/Service.md @@ -3,6 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**l2vpn_ptp** | **object** | | [optional] +**l2vpn_ptmp** | **object** | | [optional] **monitoring_capability** | **str** | | [optional] **owner** | **str** | | [optional] **private_attributes** | **list[str]** | | [optional] diff --git a/docs/Topology.md b/docs/Topology.md index 605371e..56e1388 100644 --- a/docs/Topology.md +++ b/docs/Topology.md @@ -5,9 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | | **name** | **str** | | -**domain_service** | [**Service**](Service.md) | | [optional] +**services** | [**Service**](Service.md) | | [optional] **version** | **int** | | -**time_stamp** | **datetime** | | +**model_version** | **str** | | [optional] +**timestamp** | **datetime** | | **nodes** | [**list[Node]**](Node.md) | | **links** | [**list[Link]**](Link.md) | | **private_attributes** | **list[str]** | | [optional] diff --git a/docs/TopologyApi.md b/docs/TopologyApi.md index 6eb8641..18f7156 100644 --- a/docs/TopologyApi.md +++ b/docs/TopologyApi.md @@ -1,6 +1,6 @@ # swagger_client.TopologyApi -All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/1.0.0* +All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -11,7 +11,7 @@ Method | HTTP request | Description [**get_topologyby_version**](TopologyApi.md#get_topologyby_version) | **GET** /topology/{version} | Find topology by version [**topology_version**](TopologyApi.md#topology_version) | **GET** /topology/version | Finds topology version [**update_topology**](TopologyApi.md#update_topology) | **PUT** /topology | Update an existing topology -[**upload_file**](TopologyApi.md#upload_file) | **POST** /topology/{topologyId}/uploadImage | uploads an topology image +[**upload_file**](TopologyApi.md#upload_file) | **POST** /topology/{topology_id}/uploadImage | uploads an topology image # **add_topology** > Topology add_topology(body) @@ -60,7 +60,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **delete_topology** -> delete_topology(topology_id, api_key=api_key) +> delete_topology(topology_id) Deletes a topology @@ -72,18 +72,13 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure OAuth2 access token for authorization: topology_auth -configuration = swagger_client.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # create an instance of the API class -api_instance = swagger_client.TopologyApi(swagger_client.ApiClient(configuration)) +api_instance = swagger_client.TopologyApi() topology_id = 789 # int | ID of topology to delete -api_key = 'api_key_example' # str | (optional) try: # Deletes a topology - api_instance.delete_topology(topology_id, api_key=api_key) + api_instance.delete_topology(topology_id) except ApiException as e: print("Exception when calling TopologyApi->delete_topology: %s\n" % e) ``` @@ -93,7 +88,6 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **topology_id** | **int**| ID of topology to delete | - **api_key** | **str**| | [optional] ### Return type @@ -101,7 +95,7 @@ void (empty response body) ### Authorization -[topology_auth](../README.md#topology_auth) +No authorization required ### HTTP request headers @@ -111,7 +105,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **delete_topology_version** -> delete_topology_version(topology_id, version, api_key=api_key) +> delete_topology_version(topology_id, version) Deletes a topology version @@ -123,19 +117,14 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure OAuth2 access token for authorization: topology_auth -configuration = swagger_client.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # create an instance of the API class -api_instance = swagger_client.TopologyApi(swagger_client.ApiClient(configuration)) +api_instance = swagger_client.TopologyApi() topology_id = 789 # int | ID of topology to return version = 789 # int | topology version to delete -api_key = 'api_key_example' # str | (optional) try: # Deletes a topology version - api_instance.delete_topology_version(topology_id, version, api_key=api_key) + api_instance.delete_topology_version(topology_id, version) except ApiException as e: print("Exception when calling TopologyApi->delete_topology_version: %s\n" % e) ``` @@ -146,7 +135,6 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **topology_id** | **int**| ID of topology to return | **version** | **int**| topology version to delete | - **api_key** | **str**| | [optional] ### Return type @@ -154,7 +142,7 @@ void (empty response body) ### Authorization -[topology_auth](../README.md#topology_auth) +No authorization required ### HTTP request headers @@ -222,14 +210,8 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure API key authorization: api_key -configuration = swagger_client.Configuration() -configuration.api_key['api_key'] = 'YOUR_API_KEY' -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['api_key'] = 'Bearer' - # create an instance of the API class -api_instance = swagger_client.TopologyApi(swagger_client.ApiClient(configuration)) +api_instance = swagger_client.TopologyApi() topology_id = 789 # int | ID of topology to return version = 789 # int | version of topology to return @@ -254,7 +236,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key) +No authorization required ### HTTP request headers @@ -278,12 +260,8 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure OAuth2 access token for authorization: topology_auth -configuration = swagger_client.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # create an instance of the API class -api_instance = swagger_client.TopologyApi(swagger_client.ApiClient(configuration)) +api_instance = swagger_client.TopologyApi() topology_id = 'topology_id_example' # str | topology id try: @@ -306,7 +284,7 @@ Name | Type | Description | Notes ### Authorization -[topology_auth](../README.md#topology_auth) +No authorization required ### HTTP request headers @@ -375,12 +353,8 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure OAuth2 access token for authorization: topology_auth -configuration = swagger_client.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # create an instance of the API class -api_instance = swagger_client.TopologyApi(swagger_client.ApiClient(configuration)) +api_instance = swagger_client.TopologyApi() topology_id = 789 # int | ID of topology to update body = swagger_client.Object() # Object | (optional) @@ -405,7 +379,7 @@ Name | Type | Description | Notes ### Authorization -[topology_auth](../README.md#topology_auth) +No authorization required ### HTTP request headers diff --git a/docs/UserApi.md b/docs/UserApi.md index 0c31923..f41986a 100644 --- a/docs/UserApi.md +++ b/docs/UserApi.md @@ -1,6 +1,6 @@ # swagger_client.UserApi -All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/1.0.0* +All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/requirements.txt b/requirements.txt index 591a426..bafdc07 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,3 @@ six >= 1.10 python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15.1 -connexion == 2.14.1 diff --git a/setup.py b/setup.py index 4107189..4046b56 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/swagger_client/__init__.py b/swagger_client/__init__.py index c962d14..d9e3a8f 100644 --- a/swagger_client/__init__.py +++ b/swagger_client/__init__.py @@ -7,7 +7,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -20,11 +20,9 @@ from swagger_client.api.node_api import NodeApi from swagger_client.api.topology_api import TopologyApi from swagger_client.api.user_api import UserApi - # import ApiClient from swagger_client.api_client import ApiClient from swagger_client.configuration import Configuration - # import models into sdk package from swagger_client.models.api_response import ApiResponse from swagger_client.models.connection import Connection diff --git a/swagger_client/api/connection_api.py b/swagger_client/api/connection_api.py index 207df09..2b319f6 100644 --- a/swagger_client/api/connection_api.py +++ b/swagger_client/api/connection_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -42,7 +42,7 @@ def delete_connection(self, connection_id, **kwargs): # noqa: E501 >>> result = thread.get() :param async_req bool - :param int connection_id: ID of the connection that needs to be deleted (required) + :param str connection_id: ID of the connection that needs to be deleted (required) :return: None If the method is called asynchronously, returns the request thread. @@ -68,7 +68,7 @@ def delete_connection_with_http_info(self, connection_id, **kwargs): # noqa: E5 >>> result = thread.get() :param async_req bool - :param int connection_id: ID of the connection that needs to be deleted (required) + :param str connection_id: ID of the connection that needs to be deleted (required) :return: None If the method is called asynchronously, returns the request thread. @@ -99,7 +99,7 @@ def delete_connection_with_http_info(self, connection_id, **kwargs): # noqa: E5 path_params = {} if "connection_id" in params: - path_params["connectionId"] = params["connection_id"] # noqa: E501 + path_params["connection_id"] = params["connection_id"] # noqa: E501 query_params = [] @@ -113,7 +113,7 @@ def delete_connection_with_http_info(self, connection_id, **kwargs): # noqa: E5 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/connection/{connectionId}", + "/connection/{connection_id}", "DELETE", path_params, query_params, @@ -140,7 +140,7 @@ def getconnection_by_id(self, connection_id, **kwargs): # noqa: E501 >>> result = thread.get() :param async_req bool - :param int connection_id: ID of connection that needs to be fetched (required) + :param str connection_id: ID of connection that needs to be fetched (required) :return: Connection If the method is called asynchronously, returns the request thread. @@ -166,7 +166,7 @@ def getconnection_by_id_with_http_info(self, connection_id, **kwargs): # noqa: >>> result = thread.get() :param async_req bool - :param int connection_id: ID of connection that needs to be fetched (required) + :param str connection_id: ID of connection that needs to be fetched (required) :return: Connection If the method is called asynchronously, returns the request thread. @@ -197,7 +197,7 @@ def getconnection_by_id_with_http_info(self, connection_id, **kwargs): # noqa: path_params = {} if "connection_id" in params: - path_params["connectionId"] = params["connection_id"] # noqa: E501 + path_params["connection_id"] = params["connection_id"] # noqa: E501 query_params = [] @@ -216,7 +216,7 @@ def getconnection_by_id_with_http_info(self, connection_id, **kwargs): # noqa: auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/connection/{connectionId}", + "/connection/{connection_id}", "GET", path_params, query_params, @@ -310,10 +310,10 @@ def place_connection_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/link_api.py b/swagger_client/api/link_api.py index 15f74b6..1c339a4 100644 --- a/swagger_client/api/link_api.py +++ b/swagger_client/api/link_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -104,14 +104,14 @@ def add_link_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting - auth_settings = ["topology_auth"] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( "/link", @@ -141,7 +141,6 @@ def delete_link(self, node_id, **kwargs): # noqa: E501 :param async_req bool :param int node_id: ID of link to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. @@ -163,13 +162,12 @@ def delete_link_with_http_info(self, node_id, **kwargs): # noqa: E501 :param async_req bool :param int node_id: ID of link to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. """ - all_params = ["node_id", "api_key"] # noqa: E501 + all_params = ["node_id"] # noqa: E501 all_params.append("async_req") all_params.append("_return_http_data_only") all_params.append("_preload_content") @@ -196,18 +194,16 @@ def delete_link_with_http_info(self, node_id, **kwargs): # noqa: E501 query_params = [] if "node_id" in params: - query_params.append(("nodeId", params["node_id"])) # noqa: E501 + query_params.append(("node_id", params["node_id"])) # noqa: E501 header_params = {} - if "api_key" in params: - header_params["api_key"] = params["api_key"] # noqa: E501 form_params = [] local_var_files = {} body_params = None # Authentication setting - auth_settings = ["topology_auth"] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( "/link", @@ -386,10 +382,10 @@ def update_link_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/node_api.py b/swagger_client/api/node_api.py index e662fbe..9555b44 100644 --- a/swagger_client/api/node_api.py +++ b/swagger_client/api/node_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -109,10 +109,10 @@ def add_node_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -146,7 +146,6 @@ def delete_node(self, node_id, **kwargs): # noqa: E501 :param async_req bool :param int node_id: ID of node to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. @@ -168,13 +167,12 @@ def delete_node_with_http_info(self, node_id, **kwargs): # noqa: E501 :param async_req bool :param int node_id: ID of node to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. """ - all_params = ["node_id", "api_key"] # noqa: E501 + all_params = ["node_id"] # noqa: E501 all_params.append("async_req") all_params.append("_return_http_data_only") all_params.append("_preload_content") @@ -201,11 +199,9 @@ def delete_node_with_http_info(self, node_id, **kwargs): # noqa: E501 query_params = [] if "node_id" in params: - query_params.append(("nodeId", params["node_id"])) # noqa: E501 + query_params.append(("node_id", params["node_id"])) # noqa: E501 header_params = {} - if "api_key" in params: - header_params["api_key"] = params["api_key"] # noqa: E501 form_params = [] local_var_files = {} @@ -391,10 +387,10 @@ def update_node_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/topology_api.py b/swagger_client/api/topology_api.py index 9ccfc6e..2205ba8 100644 --- a/swagger_client/api/topology_api.py +++ b/swagger_client/api/topology_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -109,10 +109,10 @@ def add_topology_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -146,7 +146,6 @@ def delete_topology(self, topology_id, **kwargs): # noqa: E501 :param async_req bool :param int topology_id: ID of topology to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. @@ -172,13 +171,12 @@ def delete_topology_with_http_info(self, topology_id, **kwargs): # noqa: E501 :param async_req bool :param int topology_id: ID of topology to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. """ - all_params = ["topology_id", "api_key"] # noqa: E501 + all_params = ["topology_id"] # noqa: E501 all_params.append("async_req") all_params.append("_return_http_data_only") all_params.append("_preload_content") @@ -205,18 +203,16 @@ def delete_topology_with_http_info(self, topology_id, **kwargs): # noqa: E501 query_params = [] if "topology_id" in params: - query_params.append(("topologyId", params["topology_id"])) # noqa: E501 + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 header_params = {} - if "api_key" in params: - header_params["api_key"] = params["api_key"] # noqa: E501 form_params = [] local_var_files = {} body_params = None # Authentication setting - auth_settings = ["topology_auth"] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( "/topology", @@ -247,7 +243,6 @@ def delete_topology_version(self, topology_id, version, **kwargs): # noqa: E501 :param async_req bool :param int topology_id: ID of topology to return (required) :param int version: topology version to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. @@ -276,13 +271,12 @@ def delete_topology_version_with_http_info( :param async_req bool :param int topology_id: ID of topology to return (required) :param int version: topology version to delete (required) - :param str api_key: :return: None If the method is called asynchronously, returns the request thread. """ - all_params = ["topology_id", "version", "api_key"] # noqa: E501 + all_params = ["topology_id", "version"] # noqa: E501 all_params.append("async_req") all_params.append("_return_http_data_only") all_params.append("_preload_content") @@ -316,18 +310,16 @@ def delete_topology_version_with_http_info( query_params = [] if "topology_id" in params: - query_params.append(("topologyId", params["topology_id"])) # noqa: E501 + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 header_params = {} - if "api_key" in params: - header_params["api_key"] = params["api_key"] # noqa: E501 form_params = [] local_var_files = {} body_params = None # Authentication setting - auth_settings = ["topology_auth"] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( "/topology/{version}", @@ -517,7 +509,7 @@ def get_topologyby_version_with_http_info( query_params = [] if "topology_id" in params: - query_params.append(("topologyId", params["topology_id"])) # noqa: E501 + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 header_params = {} @@ -531,7 +523,7 @@ def get_topologyby_version_with_http_info( ) # noqa: E501 # Authentication setting - auth_settings = ["api_key"] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( "/topology/{version}", @@ -620,7 +612,7 @@ def topology_version_with_http_info(self, topology_id, **kwargs): # noqa: E501 query_params = [] if "topology_id" in params: - query_params.append(("topologyId", params["topology_id"])) # noqa: E501 + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 header_params = {} @@ -634,7 +626,7 @@ def topology_version_with_http_info(self, topology_id, **kwargs): # noqa: E501 ) # noqa: E501 # Authentication setting - auth_settings = ["topology_auth"] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( "/topology/version", @@ -728,10 +720,10 @@ def update_topology_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -820,7 +812,7 @@ def upload_file_with_http_info(self, topology_id, **kwargs): # noqa: E501 path_params = {} if "topology_id" in params: - path_params["topologyId"] = params["topology_id"] # noqa: E501 + path_params["topology_id"] = params["topology_id"] # noqa: E501 query_params = [] @@ -838,17 +830,17 @@ def upload_file_with_http_info(self, topology_id, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/octet-stream"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/octet-stream"] + ) ) # noqa: E501 # Authentication setting - auth_settings = ["topology_auth"] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/topology/{topologyId}/uploadImage", + "/topology/{topology_id}/uploadImage", "POST", path_params, query_params, diff --git a/swagger_client/api/user_api.py b/swagger_client/api/user_api.py index f8e744f..0dd9809 100644 --- a/swagger_client/api/user_api.py +++ b/swagger_client/api/user_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -106,10 +106,10 @@ def create_user_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -211,10 +211,10 @@ def create_users_with_array_input_with_http_info( if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -314,10 +314,10 @@ def create_users_with_list_input_with_http_info(self, body, **kwargs): # noqa: if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -816,10 +816,10 @@ def update_user_with_http_info(self, body, username, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api_client.py b/swagger_client/api_client.py index bb44829..33de0b4 100644 --- a/swagger_client/api_client.py +++ b/swagger_client/api_client.py @@ -4,7 +4,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/swagger_client/configuration.py b/swagger_client/configuration.py index d617718..1156ba1 100644 --- a/swagger_client/configuration.py +++ b/swagger_client/configuration.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -15,7 +15,6 @@ import copy import logging import multiprocessing -import os import sys import six @@ -47,11 +46,7 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): def __init__(self): """Constructor""" # Default Base url - # self.host = "https://virtserver.swaggerhub.com/SDX-LC/1.0.0" - self.host = "http://{}:{}/SDX-LC/{}".format( - os.getenv("SDXLC_HOST"), os.getenv("SDXLC_PORT"), os.getenv("SDXLC_VERSION") - ) - # Temp file folder for downloading files + self.host = "https://virtserver.swaggerhub.com/SDX-LC/2.0.0" # Temp file folder for downloading files self.temp_folder_path = None @@ -66,8 +61,6 @@ def __init__(self): self.username = "" # Password for HTTP basic authentication self.password = "" - # access token for OAuth - self.access_token = "" # Logging Settings self.logger = {} self.logger["package_logger"] = logging.getLogger("swagger_client") @@ -226,29 +219,19 @@ def get_basic_auth_token(self): :return: The token for basic HTTP authentication. """ - return urllib3.util.make_headers( - basic_auth=self.username + ":" + self.password - ).get("authorization") + token = "" + if self.username or self.password: + token = urllib3.util.make_headers( + basic_auth=self.username + ":" + self.password + ).get("authorization") + return token def auth_settings(self): """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - return { - "api_key": { - "type": "api_key", - "in": "header", - "key": "api_key", - "value": self.get_api_key_with_prefix("api_key"), - }, - "topology_auth": { - "type": "oauth2", - "in": "header", - "key": "Authorization", - "value": "Bearer " + self.access_token, - }, - } + return {} def to_debug_report(self): """Gets the essential information for debugging. @@ -259,6 +242,6 @@ def to_debug_report(self): "Python SDK Debug Report:\n" "OS: {env}\n" "Python Version: {pyversion}\n" - "Version of the API: 1.0.0\n" + "Version of the API: 2.0.0\n" "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) ) diff --git a/swagger_client/models/__init__.py b/swagger_client/models/__init__.py index 7c76815..8811059 100644 --- a/swagger_client/models/__init__.py +++ b/swagger_client/models/__init__.py @@ -6,7 +6,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/swagger_client/models/api_response.py b/swagger_client/models/api_response.py index 217faae..4383d17 100644 --- a/swagger_client/models/api_response.py +++ b/swagger_client/models/api_response.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -124,9 +124,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/connection.py b/swagger_client/models/connection.py index 1510f8e..bb4c292 100644 --- a/swagger_client/models/connection.py +++ b/swagger_client/models/connection.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -37,6 +37,20 @@ class Connection(object): "quantity": "int", "start_time": "datetime", "end_time": "datetime", + "multi_path": "bool", + "preempt": "bool", + "backup_path_type": "str", + "exclusive_links": "list[Link]", + "inclusive_links": "list[Link]", + "bandwidth_required": "float", + "bandwidth_measured": "float", + "latency_required": "float", + "latency_measured": "float", + "packetloss_required": "float", + "packetloss_measured": "float", + "availability_required": "float", + "availability_measured": "float", + "paths": "list[str]", "status": "str", "complete": "bool", } @@ -49,6 +63,20 @@ class Connection(object): "quantity": "quantity", "start_time": "start_time", "end_time": "end_time", + "multi_path": "multi_path", + "preempt": "preempt", + "backup_path_type": "backup_path_type", + "exclusive_links": "exclusive_links", + "inclusive_links": "inclusive_links", + "bandwidth_required": "bandwidth_required", + "bandwidth_measured": "bandwidth_measured", + "latency_required": "latency_required", + "latency_measured": "latency_measured", + "packetloss_required": "packetloss_required", + "packetloss_measured": "packetloss_measured", + "availability_required": "availability_required", + "availability_measured": "availability_measured", + "paths": "paths", "status": "status", "complete": "complete", } @@ -62,6 +90,20 @@ def __init__( quantity=None, start_time=None, end_time=None, + multi_path=None, + preempt=None, + backup_path_type=None, + exclusive_links=None, + inclusive_links=None, + bandwidth_required=None, + bandwidth_measured=None, + latency_required=None, + latency_measured=None, + packetloss_required=None, + packetloss_measured=None, + availability_required=None, + availability_measured=None, + paths=None, status=None, complete=False, ): # noqa: E501 @@ -73,6 +115,20 @@ def __init__( self._quantity = None self._start_time = None self._end_time = None + self._multi_path = None + self._preempt = None + self._backup_path_type = None + self._exclusive_links = None + self._inclusive_links = None + self._bandwidth_required = None + self._bandwidth_measured = None + self._latency_required = None + self._latency_measured = None + self._packetloss_required = None + self._packetloss_measured = None + self._availability_required = None + self._availability_measured = None + self._paths = None self._status = None self._complete = None self.discriminator = None @@ -86,6 +142,34 @@ def __init__( self.start_time = start_time if end_time is not None: self.end_time = end_time + if multi_path is not None: + self.multi_path = multi_path + if preempt is not None: + self.preempt = preempt + if backup_path_type is not None: + self.backup_path_type = backup_path_type + if exclusive_links is not None: + self.exclusive_links = exclusive_links + if inclusive_links is not None: + self.inclusive_links = inclusive_links + if bandwidth_required is not None: + self.bandwidth_required = bandwidth_required + if bandwidth_measured is not None: + self.bandwidth_measured = bandwidth_measured + if latency_required is not None: + self.latency_required = latency_required + if latency_measured is not None: + self.latency_measured = latency_measured + if packetloss_required is not None: + self.packetloss_required = packetloss_required + if packetloss_measured is not None: + self.packetloss_measured = packetloss_measured + if availability_required is not None: + self.availability_required = availability_required + if availability_measured is not None: + self.availability_measured = availability_measured + if paths is not None: + self.paths = paths if status is not None: self.status = status if complete is not None: @@ -252,6 +336,307 @@ def end_time(self, end_time): self._end_time = end_time + @property + def multi_path(self): + """Gets the multi_path of this Connection. # noqa: E501 + + + :return: The multi_path of this Connection. # noqa: E501 + :rtype: bool + """ + return self._multi_path + + @multi_path.setter + def multi_path(self, multi_path): + """Sets the multi_path of this Connection. + + + :param multi_path: The multi_path of this Connection. # noqa: E501 + :type: bool + """ + + self._multi_path = multi_path + + @property + def preempt(self): + """Gets the preempt of this Connection. # noqa: E501 + + + :return: The preempt of this Connection. # noqa: E501 + :rtype: bool + """ + return self._preempt + + @preempt.setter + def preempt(self, preempt): + """Sets the preempt of this Connection. + + + :param preempt: The preempt of this Connection. # noqa: E501 + :type: bool + """ + + self._preempt = preempt + + @property + def backup_path_type(self): + """Gets the backup_path_type of this Connection. # noqa: E501 + + + :return: The backup_path_type of this Connection. # noqa: E501 + :rtype: str + """ + return self._backup_path_type + + @backup_path_type.setter + def backup_path_type(self, backup_path_type): + """Sets the backup_path_type of this Connection. + + + :param backup_path_type: The backup_path_type of this Connection. # noqa: E501 + :type: str + """ + allowed_values = ["0", "1", "2", "3"] # noqa: E501 + if backup_path_type not in allowed_values: + raise ValueError( + "Invalid value for `backup_path_type` ({0}), must be one of {1}".format( # noqa: E501 + backup_path_type, allowed_values + ) + ) + + self._backup_path_type = backup_path_type + + @property + def exclusive_links(self): + """Gets the exclusive_links of this Connection. # noqa: E501 + + + :return: The exclusive_links of this Connection. # noqa: E501 + :rtype: list[Link] + """ + return self._exclusive_links + + @exclusive_links.setter + def exclusive_links(self, exclusive_links): + """Sets the exclusive_links of this Connection. + + + :param exclusive_links: The exclusive_links of this Connection. # noqa: E501 + :type: list[Link] + """ + + self._exclusive_links = exclusive_links + + @property + def inclusive_links(self): + """Gets the inclusive_links of this Connection. # noqa: E501 + + + :return: The inclusive_links of this Connection. # noqa: E501 + :rtype: list[Link] + """ + return self._inclusive_links + + @inclusive_links.setter + def inclusive_links(self, inclusive_links): + """Sets the inclusive_links of this Connection. + + + :param inclusive_links: The inclusive_links of this Connection. # noqa: E501 + :type: list[Link] + """ + + self._inclusive_links = inclusive_links + + @property + def bandwidth_required(self): + """Gets the bandwidth_required of this Connection. # noqa: E501 + + + :return: The bandwidth_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._bandwidth_required + + @bandwidth_required.setter + def bandwidth_required(self, bandwidth_required): + """Sets the bandwidth_required of this Connection. + + + :param bandwidth_required: The bandwidth_required of this Connection. # noqa: E501 + :type: float + """ + + self._bandwidth_required = bandwidth_required + + @property + def bandwidth_measured(self): + """Gets the bandwidth_measured of this Connection. # noqa: E501 + + + :return: The bandwidth_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._bandwidth_measured + + @bandwidth_measured.setter + def bandwidth_measured(self, bandwidth_measured): + """Sets the bandwidth_measured of this Connection. + + + :param bandwidth_measured: The bandwidth_measured of this Connection. # noqa: E501 + :type: float + """ + + self._bandwidth_measured = bandwidth_measured + + @property + def latency_required(self): + """Gets the latency_required of this Connection. # noqa: E501 + + + :return: The latency_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._latency_required + + @latency_required.setter + def latency_required(self, latency_required): + """Sets the latency_required of this Connection. + + + :param latency_required: The latency_required of this Connection. # noqa: E501 + :type: float + """ + + self._latency_required = latency_required + + @property + def latency_measured(self): + """Gets the latency_measured of this Connection. # noqa: E501 + + + :return: The latency_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._latency_measured + + @latency_measured.setter + def latency_measured(self, latency_measured): + """Sets the latency_measured of this Connection. + + + :param latency_measured: The latency_measured of this Connection. # noqa: E501 + :type: float + """ + + self._latency_measured = latency_measured + + @property + def packetloss_required(self): + """Gets the packetloss_required of this Connection. # noqa: E501 + + + :return: The packetloss_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._packetloss_required + + @packetloss_required.setter + def packetloss_required(self, packetloss_required): + """Sets the packetloss_required of this Connection. + + + :param packetloss_required: The packetloss_required of this Connection. # noqa: E501 + :type: float + """ + + self._packetloss_required = packetloss_required + + @property + def packetloss_measured(self): + """Gets the packetloss_measured of this Connection. # noqa: E501 + + + :return: The packetloss_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._packetloss_measured + + @packetloss_measured.setter + def packetloss_measured(self, packetloss_measured): + """Sets the packetloss_measured of this Connection. + + + :param packetloss_measured: The packetloss_measured of this Connection. # noqa: E501 + :type: float + """ + + self._packetloss_measured = packetloss_measured + + @property + def availability_required(self): + """Gets the availability_required of this Connection. # noqa: E501 + + + :return: The availability_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._availability_required + + @availability_required.setter + def availability_required(self, availability_required): + """Sets the availability_required of this Connection. + + + :param availability_required: The availability_required of this Connection. # noqa: E501 + :type: float + """ + + self._availability_required = availability_required + + @property + def availability_measured(self): + """Gets the availability_measured of this Connection. # noqa: E501 + + + :return: The availability_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._availability_measured + + @availability_measured.setter + def availability_measured(self, availability_measured): + """Sets the availability_measured of this Connection. + + + :param availability_measured: The availability_measured of this Connection. # noqa: E501 + :type: float + """ + + self._availability_measured = availability_measured + + @property + def paths(self): + """Gets the paths of this Connection. # noqa: E501 + + + :return: The paths of this Connection. # noqa: E501 + :rtype: list[str] + """ + return self._paths + + @paths.setter + def paths(self, paths): + """Sets the paths of this Connection. + + + :param paths: The paths of this Connection. # noqa: E501 + :type: list[str] + """ + + self._paths = paths + @property def status(self): """Gets the status of this Connection. # noqa: E501 @@ -318,9 +703,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/link.py b/swagger_client/models/link.py index 3b0ae14..d8b1166 100644 --- a/swagger_client/models/link.py +++ b/swagger_client/models/link.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -42,7 +42,7 @@ class Link(object): "status": "str", "state": "str", "private_attributes": "list[str]", - "time_stamp": "datetime", + "timestamp": "datetime", "measurement_period": "LinkMeasurementPeriod", } @@ -59,7 +59,7 @@ class Link(object): "status": "status", "state": "state", "private_attributes": "private_attributes", - "time_stamp": "time_stamp", + "timestamp": "timestamp", "measurement_period": "measurement_period", } @@ -77,7 +77,7 @@ def __init__( status=None, state=None, private_attributes=None, - time_stamp=None, + timestamp=None, measurement_period=None, ): # noqa: E501 """Link - a model defined in Swagger""" # noqa: E501 @@ -93,7 +93,7 @@ def __init__( self._status = None self._state = None self._private_attributes = None - self._time_stamp = None + self._timestamp = None self._measurement_period = None self.discriminator = None self.id = id @@ -117,8 +117,8 @@ def __init__( self.state = state if private_attributes is not None: self.private_attributes = private_attributes - if time_stamp is not None: - self.time_stamp = time_stamp + if timestamp is not None: + self.timestamp = timestamp if measurement_period is not None: self.measurement_period = measurement_period @@ -385,25 +385,25 @@ def private_attributes(self, private_attributes): self._private_attributes = private_attributes @property - def time_stamp(self): - """Gets the time_stamp of this Link. # noqa: E501 + def timestamp(self): + """Gets the timestamp of this Link. # noqa: E501 - :return: The time_stamp of this Link. # noqa: E501 + :return: The timestamp of this Link. # noqa: E501 :rtype: datetime """ - return self._time_stamp + return self._timestamp - @time_stamp.setter - def time_stamp(self, time_stamp): - """Sets the time_stamp of this Link. + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this Link. - :param time_stamp: The time_stamp of this Link. # noqa: E501 + :param timestamp: The timestamp of this Link. # noqa: E501 :type: datetime """ - self._time_stamp = time_stamp + self._timestamp = timestamp @property def measurement_period(self): @@ -441,9 +441,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/link_measurement_period.py b/swagger_client/models/link_measurement_period.py index 7c1ae02..bf5cef4 100644 --- a/swagger_client/models/link_measurement_period.py +++ b/swagger_client/models/link_measurement_period.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -100,9 +100,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/location.py b/swagger_client/models/location.py index 247c600..f4f34af 100644 --- a/swagger_client/models/location.py +++ b/swagger_client/models/location.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -29,19 +29,28 @@ class Location(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"address": "str", "latitude": "float", "longitude": "float"} + swagger_types = { + "address": "str", + "latitude": "float", + "longitude": "float", + "iso3166_2_lvl4": "str", + } attribute_map = { "address": "address", "latitude": "latitude", "longitude": "longitude", + "iso3166_2_lvl4": "iso3166_2_lvl4", } - def __init__(self, address=None, latitude=None, longitude=None): # noqa: E501 + def __init__( + self, address=None, latitude=None, longitude=None, iso3166_2_lvl4=None + ): # noqa: E501 """Location - a model defined in Swagger""" # noqa: E501 self._address = None self._latitude = None self._longitude = None + self._iso3166_2_lvl4 = None self.discriminator = None if address is not None: self.address = address @@ -49,6 +58,8 @@ def __init__(self, address=None, latitude=None, longitude=None): # noqa: E501 self.latitude = latitude if longitude is not None: self.longitude = longitude + if iso3166_2_lvl4 is not None: + self.iso3166_2_lvl4 = iso3166_2_lvl4 @property def address(self): @@ -113,6 +124,27 @@ def longitude(self, longitude): self._longitude = longitude + @property + def iso3166_2_lvl4(self): + """Gets the iso3166_2_lvl4 of this Location. # noqa: E501 + + + :return: The iso3166_2_lvl4 of this Location. # noqa: E501 + :rtype: str + """ + return self._iso3166_2_lvl4 + + @iso3166_2_lvl4.setter + def iso3166_2_lvl4(self, iso3166_2_lvl4): + """Sets the iso3166_2_lvl4 of this Location. + + + :param iso3166_2_lvl4: The iso3166_2_lvl4 of this Location. # noqa: E501 + :type: str + """ + + self._iso3166_2_lvl4 = iso3166_2_lvl4 + def to_dict(self): """Returns the model properties as a dict""" result = {} @@ -128,9 +160,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/node.py b/swagger_client/models/node.py index 6cc5c3d..a4ae60a 100644 --- a/swagger_client/models/node.py +++ b/swagger_client/models/node.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -228,9 +228,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/port.py b/swagger_client/models/port.py index 1f2dc38..2df73e2 100644 --- a/swagger_client/models/port.py +++ b/swagger_client/models/port.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -37,6 +37,7 @@ class Port(object): "label_range": "list[str]", "status": "str", "state": "str", + "services": "Service", "private_attributes": "list[str]", } @@ -48,6 +49,7 @@ class Port(object): "label_range": "label_range", "status": "status", "state": "state", + "services": "services", "private_attributes": "private_attributes", } @@ -60,6 +62,7 @@ def __init__( label_range=None, status=None, state=None, + services=None, private_attributes=None, ): # noqa: E501 """Port - a model defined in Swagger""" # noqa: E501 @@ -70,6 +73,7 @@ def __init__( self._label_range = None self._status = None self._state = None + self._services = None self._private_attributes = None self.discriminator = None self.id = id @@ -82,6 +86,8 @@ def __init__( self.status = status if state is not None: self.state = state + if services is not None: + self.services = services if private_attributes is not None: self.private_attributes = private_attributes @@ -246,6 +252,27 @@ def state(self, state): self._state = state + @property + def services(self): + """Gets the services of this Port. # noqa: E501 + + + :return: The services of this Port. # noqa: E501 + :rtype: Service + """ + return self._services + + @services.setter + def services(self, services): + """Sets the services of this Port. + + + :param services: The services of this Port. # noqa: E501 + :type: Service + """ + + self._services = services + @property def private_attributes(self): """Gets the private_attributes of this Port. # noqa: E501 @@ -282,9 +309,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/service.py b/swagger_client/models/service.py index f43fdfb..1a5a2d4 100644 --- a/swagger_client/models/service.py +++ b/swagger_client/models/service.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -30,6 +30,8 @@ class Service(object): and the value is json key in definition. """ swagger_types = { + "l2vpn_ptp": "object", + "l2vpn_ptmp": "object", "monitoring_capability": "str", "owner": "str", "private_attributes": "list[str]", @@ -39,6 +41,8 @@ class Service(object): } attribute_map = { + "l2vpn_ptp": "l2vpn-ptp", + "l2vpn_ptmp": "l2vpn-ptmp", "monitoring_capability": "monitoring_capability", "owner": "owner", "private_attributes": "private_attributes", @@ -49,6 +53,8 @@ class Service(object): def __init__( self, + l2vpn_ptp=None, + l2vpn_ptmp=None, monitoring_capability=None, owner=None, private_attributes=None, @@ -57,6 +63,8 @@ def __init__( vendor=None, ): # noqa: E501 """Service - a model defined in Swagger""" # noqa: E501 + self._l2vpn_ptp = None + self._l2vpn_ptmp = None self._monitoring_capability = None self._owner = None self._private_attributes = None @@ -64,6 +72,10 @@ def __init__( self._provisioning_url = None self._vendor = None self.discriminator = None + if l2vpn_ptp is not None: + self.l2vpn_ptp = l2vpn_ptp + if l2vpn_ptmp is not None: + self.l2vpn_ptmp = l2vpn_ptmp if monitoring_capability is not None: self.monitoring_capability = monitoring_capability if owner is not None: @@ -77,6 +89,48 @@ def __init__( if vendor is not None: self.vendor = vendor + @property + def l2vpn_ptp(self): + """Gets the l2vpn_ptp of this Service. # noqa: E501 + + + :return: The l2vpn_ptp of this Service. # noqa: E501 + :rtype: object + """ + return self._l2vpn_ptp + + @l2vpn_ptp.setter + def l2vpn_ptp(self, l2vpn_ptp): + """Sets the l2vpn_ptp of this Service. + + + :param l2vpn_ptp: The l2vpn_ptp of this Service. # noqa: E501 + :type: object + """ + + self._l2vpn_ptp = l2vpn_ptp + + @property + def l2vpn_ptmp(self): + """Gets the l2vpn_ptmp of this Service. # noqa: E501 + + + :return: The l2vpn_ptmp of this Service. # noqa: E501 + :rtype: object + """ + return self._l2vpn_ptmp + + @l2vpn_ptmp.setter + def l2vpn_ptmp(self, l2vpn_ptmp): + """Sets the l2vpn_ptmp of this Service. + + + :param l2vpn_ptmp: The l2vpn_ptmp of this Service. # noqa: E501 + :type: object + """ + + self._l2vpn_ptmp = l2vpn_ptmp + @property def monitoring_capability(self): """Gets the monitoring_capability of this Service. # noqa: E501 @@ -218,9 +272,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/topology.py b/swagger_client/models/topology.py index b39d5ea..b03a36f 100644 --- a/swagger_client/models/topology.py +++ b/swagger_client/models/topology.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -32,9 +32,10 @@ class Topology(object): swagger_types = { "id": "str", "name": "str", - "domain_service": "Service", + "services": "Service", "version": "int", - "time_stamp": "datetime", + "model_version": "str", + "timestamp": "datetime", "nodes": "list[Node]", "links": "list[Link]", "private_attributes": "list[str]", @@ -43,9 +44,10 @@ class Topology(object): attribute_map = { "id": "id", "name": "name", - "domain_service": "domain_service", + "services": "services", "version": "version", - "time_stamp": "time_stamp", + "model_version": "model_version", + "timestamp": "timestamp", "nodes": "nodes", "links": "links", "private_attributes": "private_attributes", @@ -55,9 +57,10 @@ def __init__( self, id=None, name=None, - domain_service=None, + services=None, version=None, - time_stamp=None, + model_version=None, + timestamp=None, nodes=None, links=None, private_attributes=None, @@ -65,19 +68,22 @@ def __init__( """Topology - a model defined in Swagger""" # noqa: E501 self._id = None self._name = None - self._domain_service = None + self._services = None self._version = None - self._time_stamp = None + self._model_version = None + self._timestamp = None self._nodes = None self._links = None self._private_attributes = None self.discriminator = None self.id = id self.name = name - if domain_service is not None: - self.domain_service = domain_service + if services is not None: + self.services = services self.version = version - self.time_stamp = time_stamp + if model_version is not None: + self.model_version = model_version + self.timestamp = timestamp self.nodes = nodes self.links = links if private_attributes is not None: @@ -132,25 +138,25 @@ def name(self, name): self._name = name @property - def domain_service(self): - """Gets the domain_service of this Topology. # noqa: E501 + def services(self): + """Gets the services of this Topology. # noqa: E501 - :return: The domain_service of this Topology. # noqa: E501 + :return: The services of this Topology. # noqa: E501 :rtype: Service """ - return self._domain_service + return self._services - @domain_service.setter - def domain_service(self, domain_service): - """Sets the domain_service of this Topology. + @services.setter + def services(self, services): + """Sets the services of this Topology. - :param domain_service: The domain_service of this Topology. # noqa: E501 + :param services: The services of this Topology. # noqa: E501 :type: Service """ - self._domain_service = domain_service + self._services = services @property def version(self): @@ -178,29 +184,50 @@ def version(self, version): self._version = version @property - def time_stamp(self): - """Gets the time_stamp of this Topology. # noqa: E501 + def model_version(self): + """Gets the model_version of this Topology. # noqa: E501 - :return: The time_stamp of this Topology. # noqa: E501 + :return: The model_version of this Topology. # noqa: E501 + :rtype: str + """ + return self._model_version + + @model_version.setter + def model_version(self, model_version): + """Sets the model_version of this Topology. + + + :param model_version: The model_version of this Topology. # noqa: E501 + :type: str + """ + + self._model_version = model_version + + @property + def timestamp(self): + """Gets the timestamp of this Topology. # noqa: E501 + + + :return: The timestamp of this Topology. # noqa: E501 :rtype: datetime """ - return self._time_stamp + return self._timestamp - @time_stamp.setter - def time_stamp(self, time_stamp): - """Sets the time_stamp of this Topology. + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this Topology. - :param time_stamp: The time_stamp of this Topology. # noqa: E501 + :param timestamp: The timestamp of this Topology. # noqa: E501 :type: datetime """ - if time_stamp is None: + if timestamp is None: raise ValueError( - "Invalid value for `time_stamp`, must not be `None`" + "Invalid value for `timestamp`, must not be `None`" ) # noqa: E501 - self._time_stamp = time_stamp + self._timestamp = timestamp @property def nodes(self): @@ -288,9 +315,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/models/user.py b/swagger_client/models/user.py index 3c270bb..307e188 100644 --- a/swagger_client/models/user.py +++ b/swagger_client/models/user.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -274,9 +274,11 @@ def to_dict(self): elif isinstance(value, dict): result[attr] = dict( map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), value.items(), ) ) diff --git a/swagger_client/rest.py b/swagger_client/rest.py index 1cf968c..f8288a2 100644 --- a/swagger_client/rest.py +++ b/swagger_client/rest.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -19,7 +19,6 @@ import ssl import certifi - # python 2 and python 3 compatibility library import six from six.moves.urllib.parse import urlencode @@ -34,6 +33,7 @@ class RESTResponse(io.IOBase): + def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -42,14 +42,15 @@ def __init__(self, resp): def getheaders(self): """Returns a dictionary of the response headers.""" - return self.urllib3_response.getheaders() + return self.urllib3_response.headers def getheader(self, name, default=None): """Returns a given response header.""" - return self.urllib3_response.getheader(name, default) + return self.urllib3_response.headers.get(name, default) class RESTClientObject(object): + def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -72,9 +73,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args[ - "assert_hostname" - ] = configuration.assert_hostname # noqa: E501 + addition_pool_args["assert_hostname"] = ( + configuration.assert_hostname + ) # noqa: E501 if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -148,8 +149,8 @@ def request( timeout = None if _request_timeout: if isinstance( - _request_timeout, (int,) if six.PY3 else (int, long) # noqa: E501,F821 - ): + _request_timeout, (int,) if six.PY3 else (int, long) + ): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: timeout = urllib3.Timeout( @@ -385,6 +386,7 @@ def PATCH( class ApiException(Exception): + def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status diff --git a/test-requirements.txt b/test-requirements.txt index 1a04a99..2702246 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,5 @@ -flask_testing==0.8.1 -pytest>=7.1.3 -pytest-cov>=4.0.0 +coverage>=4.0.3 +nose>=1.3.7 pluggy>=0.3.1 py>=1.4.31 randomize>=0.13 diff --git a/test/__init__.py b/test/__init__.py index e69de29..57d631c 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -0,0 +1 @@ +# coding: utf-8 diff --git a/test/test_api_response.py b/test/test_api_response.py index 8c9b94e..675b061 100644 --- a/test/test_api_response.py +++ b/test/test_api_response.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_connection.py b/test/test_connection.py index 484a41f..bc95dc4 100644 --- a/test/test_connection.py +++ b/test/test_connection.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_connection_api.py b/test/test_connection_api.py index 4b04853..eca4ce5 100644 --- a/test/test_connection_api.py +++ b/test/test_connection_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -44,35 +44,10 @@ def test_getconnection_by_id(self): def test_place_connection(self): """Test case for place_connection + Place an connection request from the SDX-Controller # noqa: E501 """ - p1 = swagger_client.Port( - id="n1:p1", name="p1", short_name="eth1", node="n1", status="UP" - ) - p2 = swagger_client.Port( - id="n2:p1", name="p2", short_name="eth2", node="n2", status="UP" - ) - timestmp = "2021-06-24T00:05:23+04:00" - connection_body = swagger_client.Connection( - id="test1", - name="test1", - ingress_port=p1, - egress_port=p2, - start_time=timestmp, - end_time=timestmp, - ) - try: - # create a connection - # logger.warning(connection_body) - api_response = self.api.place_connection(connection_body) - print(api_response) - # logger.warning(api_response) - except ApiException as e: - print(e) - # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) - return False - - return True + pass if __name__ == "__main__": diff --git a/test/test_link.py b/test/test_link.py index 7b6155a..571b08d 100644 --- a/test/test_link.py +++ b/test/test_link.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_link_api.py b/test/test_link_api.py index 83f9c23..41999ec 100644 --- a/test/test_link_api.py +++ b/test/test_link_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_link_measurement_period.py b/test/test_link_measurement_period.py index 202592e..4b313a7 100644 --- a/test/test_link_measurement_period.py +++ b/test/test_link_measurement_period.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -15,9 +15,8 @@ import unittest import swagger_client -from swagger_client.models.link_measurement_period import ( # noqa: E501 - LinkMeasurementPeriod, -) +from swagger_client.models.link_measurement_period import \ + LinkMeasurementPeriod # noqa: E501 from swagger_client.rest import ApiException diff --git a/test/test_location.py b/test/test_location.py index 8bbe54d..b28e06d 100644 --- a/test/test_location.py +++ b/test/test_location.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_node.py b/test/test_node.py index 91d0849..09be635 100644 --- a/test/test_node.py +++ b/test/test_node.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_node_api.py b/test/test_node_api.py index aae24c4..ec65ed0 100644 --- a/test/test_node_api.py +++ b/test/test_node_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -30,33 +30,10 @@ def tearDown(self): def test_add_node(self): """Test case for add_node + add a new node to the topology # noqa: E501 """ - p1 = swagger_client.Port( - id="n1:p1", name="p1", short_name="eth1", node="n1", status="UP" - ) - p2 = swagger_client.Port( - id="n2:p1", name="p2", short_name="eth2", node="n2", status="UP" - ) - ps = [] - ps.append(p1) - # ps.append(p2) - lt = swagger_client.Location( - address="miami", latitude=-28.51107891831147, longitude=-79.57947854792273 - ) - node_body = swagger_client.Node(id="test1", name="test1", location=lt, ports=ps) - try: - # create a connection - # logger.warning(connection_body) - api_response = self.api.add_node(node_body) - print(api_response) - # logger.warning(api_response) - except ApiException as e: - print(e) - # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) - return False - - return True + pass def test_delete_node(self): """Test case for delete_node diff --git a/test/test_port.py b/test/test_port.py index 5b0297e..42a45b7 100644 --- a/test/test_port.py +++ b/test/test_port.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_service.py b/test/test_service.py index 42866e3..df79ead 100644 --- a/test/test_service.py +++ b/test/test_service.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_topology.py b/test/test_topology.py index 91eb66f..2ca2668 100644 --- a/test/test_topology.py +++ b/test/test_topology.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_topology_api.py b/test/test_topology_api.py index cee5f44..e456bbf 100644 --- a/test/test_topology_api.py +++ b/test/test_topology_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -30,48 +30,10 @@ def tearDown(self): def test_add_topology(self): """Test case for add_topology + Send a new topology to SDX-LC # noqa: E501 """ - p1 = swagger_client.Port( - id="n1:p1", name="p1", short_name="eth1", node="n1", status="UP" - ) - p2 = swagger_client.Port( - id="n2:p1", name="p2", short_name="eth2", node="n2", status="UP" - ) - ps = [] - ps.append(p1) - ps.append(p2) - lt = swagger_client.Location(address="miami") - node = swagger_client.Node(id="node1", name="node1", location=lt, ports=ps) - ns = [] - ns.append(node) - - link = swagger_client.Link(id="link1", name="link1", ports=ps) - ls = [] - ls.append(link) - - timestmp = "2021-06-24T04:56:07+00:00" - topology_body = swagger_client.Topology( - id="topology1", - name="topology1", - nodes=ns, - links=ls, - version=1, - time_stamp=timestmp, - ) - - try: - # create a connection - # logger.warning(connection_body) - api_response = self.api.add_topology(topology_body) - print(api_response) - # logger.warning(api_response) - except ApiException as e: - print(e) - # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) - return False - - return True + pass def test_delete_topology(self): """Test case for delete_topology diff --git a/test/test_user.py b/test/test_user.py index 516f2c7..fea440a 100644 --- a/test/test_user.py +++ b/test/test_user.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_user_api.py b/test/test_user_api.py index 24fd1fa..1bfb1ee 100644 --- a/test/test_user_api.py +++ b/test/test_user_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 2.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/tox.ini b/tox.ini index 06f2a0a..a310bec 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,9 @@ envlist = py3 [testenv] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -passenv = SDXLC_* -commands = - pytest --cov=swagger_client {posargs} +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + nosetests \ + [] From 569894c355174a9d2c6d724af244f9817b713c4b Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 14:03:00 -0400 Subject: [PATCH 02/13] lint --- swagger_client/api/connection_api.py | 8 +++---- swagger_client/api/link_api.py | 16 +++++++------- swagger_client/api/node_api.py | 16 +++++++------- swagger_client/api/topology_api.py | 24 ++++++++++----------- swagger_client/api/user_api.py | 32 ++++++++++++++-------------- swagger_client/api_client.py | 1 - swagger_client/rest.py | 9 +++----- 7 files changed, 51 insertions(+), 55 deletions(-) diff --git a/swagger_client/api/connection_api.py b/swagger_client/api/connection_api.py index 2b319f6..bb421ba 100644 --- a/swagger_client/api/connection_api.py +++ b/swagger_client/api/connection_api.py @@ -310,10 +310,10 @@ def place_connection_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/link_api.py b/swagger_client/api/link_api.py index 1c339a4..7517e4c 100644 --- a/swagger_client/api/link_api.py +++ b/swagger_client/api/link_api.py @@ -104,10 +104,10 @@ def add_link_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -382,10 +382,10 @@ def update_link_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/node_api.py b/swagger_client/api/node_api.py index 9555b44..8244e35 100644 --- a/swagger_client/api/node_api.py +++ b/swagger_client/api/node_api.py @@ -109,10 +109,10 @@ def add_node_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -387,10 +387,10 @@ def update_node_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/topology_api.py b/swagger_client/api/topology_api.py index 2205ba8..7c8d381 100644 --- a/swagger_client/api/topology_api.py +++ b/swagger_client/api/topology_api.py @@ -109,10 +109,10 @@ def add_topology_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -720,10 +720,10 @@ def update_topology_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -830,10 +830,10 @@ def upload_file_with_http_info(self, topology_id, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/octet-stream"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/octet-stream"] ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/user_api.py b/swagger_client/api/user_api.py index 0dd9809..2a9597d 100644 --- a/swagger_client/api/user_api.py +++ b/swagger_client/api/user_api.py @@ -106,10 +106,10 @@ def create_user_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -211,10 +211,10 @@ def create_users_with_array_input_with_http_info( if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -314,10 +314,10 @@ def create_users_with_list_input_with_http_info(self, body, **kwargs): # noqa: if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting @@ -816,10 +816,10 @@ def update_user_with_http_info(self, body, username, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params[ + "Content-Type" + ] = self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api_client.py b/swagger_client/api_client.py index 33de0b4..cdd6f4b 100644 --- a/swagger_client/api_client.py +++ b/swagger_client/api_client.py @@ -108,7 +108,6 @@ def __call_api( _preload_content=True, _request_timeout=None, ): - config = self.configuration # header parameters diff --git a/swagger_client/rest.py b/swagger_client/rest.py index f8288a2..06abb56 100644 --- a/swagger_client/rest.py +++ b/swagger_client/rest.py @@ -33,7 +33,6 @@ class RESTResponse(io.IOBase): - def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -50,7 +49,6 @@ def getheader(self, name, default=None): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -73,9 +71,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args["assert_hostname"] = ( - configuration.assert_hostname - ) # noqa: E501 + addition_pool_args[ + "assert_hostname" + ] = configuration.assert_hostname # noqa: E501 if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -386,7 +384,6 @@ def PATCH( class ApiException(Exception): - def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status From c2f4bea02e190694a23112d6eb424e60042b937a Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 14:06:58 -0400 Subject: [PATCH 03/13] lint --- swagger_client/api/connection_api.py | 8 +++---- swagger_client/api/link_api.py | 16 +++++++------- swagger_client/api/node_api.py | 16 +++++++------- swagger_client/api/topology_api.py | 24 ++++++++++----------- swagger_client/api/user_api.py | 32 ++++++++++++++-------------- swagger_client/rest.py | 6 +++--- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/swagger_client/api/connection_api.py b/swagger_client/api/connection_api.py index bb421ba..2b319f6 100644 --- a/swagger_client/api/connection_api.py +++ b/swagger_client/api/connection_api.py @@ -310,10 +310,10 @@ def place_connection_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/link_api.py b/swagger_client/api/link_api.py index 7517e4c..1c339a4 100644 --- a/swagger_client/api/link_api.py +++ b/swagger_client/api/link_api.py @@ -104,10 +104,10 @@ def add_link_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -382,10 +382,10 @@ def update_link_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/node_api.py b/swagger_client/api/node_api.py index 8244e35..9555b44 100644 --- a/swagger_client/api/node_api.py +++ b/swagger_client/api/node_api.py @@ -109,10 +109,10 @@ def add_node_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -387,10 +387,10 @@ def update_node_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/topology_api.py b/swagger_client/api/topology_api.py index 7c8d381..2205ba8 100644 --- a/swagger_client/api/topology_api.py +++ b/swagger_client/api/topology_api.py @@ -109,10 +109,10 @@ def add_topology_with_http_info(self, body, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -720,10 +720,10 @@ def update_topology_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -830,10 +830,10 @@ def upload_file_with_http_info(self, topology_id, **kwargs): # noqa: E501 ) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/octet-stream"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/octet-stream"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/api/user_api.py b/swagger_client/api/user_api.py index 2a9597d..0dd9809 100644 --- a/swagger_client/api/user_api.py +++ b/swagger_client/api/user_api.py @@ -106,10 +106,10 @@ def create_user_with_http_info(self, body, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -211,10 +211,10 @@ def create_users_with_array_input_with_http_info( if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -314,10 +314,10 @@ def create_users_with_list_input_with_http_info(self, body, **kwargs): # noqa: if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting @@ -816,10 +816,10 @@ def update_user_with_http_info(self, body, username, **kwargs): # noqa: E501 if "body" in params: body_params = params["body"] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) ) # noqa: E501 # Authentication setting diff --git a/swagger_client/rest.py b/swagger_client/rest.py index 06abb56..14de40c 100644 --- a/swagger_client/rest.py +++ b/swagger_client/rest.py @@ -71,9 +71,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args[ - "assert_hostname" - ] = configuration.assert_hostname # noqa: E501 + addition_pool_args["assert_hostname"] = ( + configuration.assert_hostname + ) # noqa: E501 if maxsize is None: if configuration.connection_pool_maxsize is not None: From 57da300c424cc3422cbeb718ac717b8712eaed39 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 15:51:49 -0400 Subject: [PATCH 04/13] lint --- swagger_client/__init__.py | 2 ++ swagger_client/rest.py | 1 + test/test_link_measurement_period.py | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/swagger_client/__init__.py b/swagger_client/__init__.py index d9e3a8f..01db43a 100644 --- a/swagger_client/__init__.py +++ b/swagger_client/__init__.py @@ -20,9 +20,11 @@ from swagger_client.api.node_api import NodeApi from swagger_client.api.topology_api import TopologyApi from swagger_client.api.user_api import UserApi + # import ApiClient from swagger_client.api_client import ApiClient from swagger_client.configuration import Configuration + # import models into sdk package from swagger_client.models.api_response import ApiResponse from swagger_client.models.connection import Connection diff --git a/swagger_client/rest.py b/swagger_client/rest.py index 14de40c..87ec24d 100644 --- a/swagger_client/rest.py +++ b/swagger_client/rest.py @@ -19,6 +19,7 @@ import ssl import certifi + # python 2 and python 3 compatibility library import six from six.moves.urllib.parse import urlencode diff --git a/test/test_link_measurement_period.py b/test/test_link_measurement_period.py index 4b313a7..c304f83 100644 --- a/test/test_link_measurement_period.py +++ b/test/test_link_measurement_period.py @@ -15,8 +15,9 @@ import unittest import swagger_client -from swagger_client.models.link_measurement_period import \ - LinkMeasurementPeriod # noqa: E501 +from swagger_client.models.link_measurement_period import ( + LinkMeasurementPeriod, +) # noqa: E501 from swagger_client.rest import ApiException From 6d798dc8821ff8ec22bd1c70c9f3451b782e5197 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 16:13:39 -0400 Subject: [PATCH 05/13] regen --- README.md | 20 +- docs/ConnectionApi.md | 22 +- docs/LinkApi.md | 30 +- docs/NodeApi.md | 30 +- docs/TopologyApi.md | 56 +- docs/UserApi.md | 58 +- setup.py | 4 +- swagger_client/__init__.py | 38 - swagger_client/api/__init__.py | 10 - swagger_client/api/connection_api.py | 338 ------- swagger_client/api/link_api.py | 410 --------- swagger_client/api/node_api.py | 415 --------- swagger_client/api/topology_api.py | 858 ------------------ swagger_client/api/user_api.py | 844 ----------------- swagger_client/api_client.py | 708 --------------- swagger_client/configuration.py | 247 ----- swagger_client/models/__init__.py | 26 - swagger_client/models/api_response.py | 160 ---- swagger_client/models/connection.py | 739 --------------- swagger_client/models/link.py | 477 ---------- .../models/link_measurement_period.py | 136 --- swagger_client/models/location.py | 196 ---- swagger_client/models/node.py | 264 ------ swagger_client/models/port.py | 345 ------- swagger_client/models/service.py | 308 ------- swagger_client/models/topology.py | 351 ------- swagger_client/models/user.py | 310 ------- swagger_client/rest.py | 409 --------- test/test_api_response.py | 8 +- test/test_connection.py | 8 +- test/test_connection_api.py | 6 +- test/test_link.py | 8 +- test/test_link_api.py | 6 +- test/test_link_measurement_period.py | 8 +- test/test_location.py | 8 +- test/test_node.py | 8 +- test/test_node_api.py | 6 +- test/test_port.py | 8 +- test/test_service.py | 8 +- test/test_topology.py | 8 +- test/test_topology_api.py | 6 +- test/test_user.py | 8 +- test/test_user_api.py | 6 +- 43 files changed, 165 insertions(+), 7754 deletions(-) delete mode 100644 swagger_client/__init__.py delete mode 100644 swagger_client/api/__init__.py delete mode 100644 swagger_client/api/connection_api.py delete mode 100644 swagger_client/api/link_api.py delete mode 100644 swagger_client/api/node_api.py delete mode 100644 swagger_client/api/topology_api.py delete mode 100644 swagger_client/api/user_api.py delete mode 100644 swagger_client/api_client.py delete mode 100644 swagger_client/configuration.py delete mode 100644 swagger_client/models/__init__.py delete mode 100644 swagger_client/models/api_response.py delete mode 100644 swagger_client/models/connection.py delete mode 100644 swagger_client/models/link.py delete mode 100644 swagger_client/models/link_measurement_period.py delete mode 100644 swagger_client/models/location.py delete mode 100644 swagger_client/models/node.py delete mode 100644 swagger_client/models/port.py delete mode 100644 swagger_client/models/service.py delete mode 100644 swagger_client/models/topology.py delete mode 100644 swagger_client/models/user.py delete mode 100644 swagger_client/rest.py diff --git a/README.md b/README.md index d7b607c..b78acce 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# swagger-client +# sdx_lc_client You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 2.0.0 -- Package version: 1.0.0 +- Package version: 2.0.0 - Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen ## Requirements. @@ -23,7 +23,7 @@ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git Then import the package: ```python -import swagger_client +import sdx_lc_client ``` ### Setuptools @@ -37,7 +37,7 @@ python setup.py install --user Then import the package: ```python -import swagger_client +import sdx_lc_client ``` ## Getting Started @@ -47,12 +47,12 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.ConnectionApi(swagger_client.ApiClient(configuration)) +api_instance = sdx_lc_client.ConnectionApi(sdx_lc_client.ApiClient(configuration)) connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of the connection that needs to be deleted try: @@ -62,7 +62,7 @@ except ApiException as e: print("Exception when calling ConnectionApi->delete_connection: %s\n" % e) # create an instance of the API class -api_instance = swagger_client.ConnectionApi(swagger_client.ApiClient(configuration)) +api_instance = sdx_lc_client.ConnectionApi(sdx_lc_client.ApiClient(configuration)) connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of connection that needs to be fetched try: @@ -73,8 +73,8 @@ except ApiException as e: print("Exception when calling ConnectionApi->getconnection_by_id: %s\n" % e) # create an instance of the API class -api_instance = swagger_client.ConnectionApi(swagger_client.ApiClient(configuration)) -body = swagger_client.Connection() # Connection | order placed for creating a connection +api_instance = sdx_lc_client.ConnectionApi(sdx_lc_client.ApiClient(configuration)) +body = sdx_lc_client.Connection() # Connection | order placed for creating a connection try: # Place an connection request from the SDX-Controller diff --git a/docs/ConnectionApi.md b/docs/ConnectionApi.md index c54e4e3..2ad0bf1 100644 --- a/docs/ConnectionApi.md +++ b/docs/ConnectionApi.md @@ -1,4 +1,4 @@ -# swagger_client.ConnectionApi +# sdx_lc_client.ConnectionApi All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* @@ -19,12 +19,12 @@ delete a connection ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.ConnectionApi() +api_instance = sdx_lc_client.ConnectionApi() connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of the connection that needs to be deleted try: @@ -66,12 +66,12 @@ connection details ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.ConnectionApi() +api_instance = sdx_lc_client.ConnectionApi() connection_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | ID of connection that needs to be fetched try: @@ -112,13 +112,13 @@ Place an connection request from the SDX-Controller ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.ConnectionApi() -body = swagger_client.Connection() # Connection | order placed for creating a connection +api_instance = sdx_lc_client.ConnectionApi() +body = sdx_lc_client.Connection() # Connection | order placed for creating a connection try: # Place an connection request from the SDX-Controller diff --git a/docs/LinkApi.md b/docs/LinkApi.md index 2f6e5c5..ab39d83 100644 --- a/docs/LinkApi.md +++ b/docs/LinkApi.md @@ -1,4 +1,4 @@ -# swagger_client.LinkApi +# sdx_lc_client.LinkApi All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* @@ -18,13 +18,13 @@ add a new link to the topology ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.LinkApi() -body = swagger_client.Link() # Link | link object that needs to be sent to the SDX LC +api_instance = sdx_lc_client.LinkApi() +body = sdx_lc_client.Link() # Link | link object that needs to be sent to the SDX LC try: # add a new link to the topology @@ -63,12 +63,12 @@ Deletes a link ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.LinkApi() +api_instance = sdx_lc_client.LinkApi() node_id = 789 # int | ID of link to delete try: @@ -110,12 +110,12 @@ ID of the link ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.LinkApi() +api_instance = sdx_lc_client.LinkApi() try: # get an existing link @@ -153,13 +153,13 @@ ID of link that needs to be updated. ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.LinkApi() -body = swagger_client.Link() # Link | link object that needs to be sent to the SDX LC +api_instance = sdx_lc_client.LinkApi() +body = sdx_lc_client.Link() # Link | link object that needs to be sent to the SDX LC try: # Update an existing link diff --git a/docs/NodeApi.md b/docs/NodeApi.md index ca9e862..a68c3d7 100644 --- a/docs/NodeApi.md +++ b/docs/NodeApi.md @@ -1,4 +1,4 @@ -# swagger_client.NodeApi +# sdx_lc_client.NodeApi All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* @@ -18,13 +18,13 @@ add a new node to the topology ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.NodeApi() -body = swagger_client.Node() # Node | node object that needs to be sent to the SDX LC +api_instance = sdx_lc_client.NodeApi() +body = sdx_lc_client.Node() # Node | node object that needs to be sent to the SDX LC try: # add a new node to the topology @@ -64,12 +64,12 @@ Deletes a node ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.NodeApi() +api_instance = sdx_lc_client.NodeApi() node_id = 789 # int | ID of node to delete try: @@ -111,12 +111,12 @@ ID of the node ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.NodeApi() +api_instance = sdx_lc_client.NodeApi() try: # get an existing node @@ -154,13 +154,13 @@ ID of node that needs to be updated. ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.NodeApi() -body = swagger_client.Node() # Node | node object that needs to be sent to the SDX LC +api_instance = sdx_lc_client.NodeApi() +body = sdx_lc_client.Node() # Node | node object that needs to be sent to the SDX LC try: # Update an existing node diff --git a/docs/TopologyApi.md b/docs/TopologyApi.md index 18f7156..3fb8c7b 100644 --- a/docs/TopologyApi.md +++ b/docs/TopologyApi.md @@ -1,4 +1,4 @@ -# swagger_client.TopologyApi +# sdx_lc_client.TopologyApi All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* @@ -22,13 +22,13 @@ Send a new topology to SDX-LC ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() -body = swagger_client.Topology() # Topology | placed for adding a new topology +api_instance = sdx_lc_client.TopologyApi() +body = sdx_lc_client.Topology() # Topology | placed for adding a new topology try: # Send a new topology to SDX-LC @@ -68,12 +68,12 @@ Deletes a topology ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() +api_instance = sdx_lc_client.TopologyApi() topology_id = 789 # int | ID of topology to delete try: @@ -113,12 +113,12 @@ Deletes a topology version ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() +api_instance = sdx_lc_client.TopologyApi() topology_id = 789 # int | ID of topology to return version = 789 # int | topology version to delete @@ -162,12 +162,12 @@ ID of the topology ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() +api_instance = sdx_lc_client.TopologyApi() try: # get an existing topology @@ -206,12 +206,12 @@ Returns a single topology ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() +api_instance = sdx_lc_client.TopologyApi() topology_id = 789 # int | ID of topology to return version = 789 # int | version of topology to return @@ -256,12 +256,12 @@ Topology version ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() +api_instance = sdx_lc_client.TopologyApi() topology_id = 'topology_id_example' # str | topology id try: @@ -304,13 +304,13 @@ ID of topology that needs to be updated. \\\\ The topology update only updates t ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() -body = swagger_client.Topology() # Topology | topology object that needs to be sent to the SDX LC +api_instance = sdx_lc_client.TopologyApi() +body = sdx_lc_client.Topology() # Topology | topology object that needs to be sent to the SDX LC try: # Update an existing topology @@ -349,14 +349,14 @@ uploads an topology image ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.TopologyApi() +api_instance = sdx_lc_client.TopologyApi() topology_id = 789 # int | ID of topology to update -body = swagger_client.Object() # Object | (optional) +body = sdx_lc_client.Object() # Object | (optional) try: # uploads an topology image diff --git a/docs/UserApi.md b/docs/UserApi.md index f41986a..7356b39 100644 --- a/docs/UserApi.md +++ b/docs/UserApi.md @@ -1,4 +1,4 @@ -# swagger_client.UserApi +# sdx_lc_client.UserApi All URIs are relative to *https://virtserver.swaggerhub.com/SDX-LC/2.0.0* @@ -24,13 +24,13 @@ This can only be done by the logged in user. ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() -body = swagger_client.User() # User | Created user object +api_instance = sdx_lc_client.UserApi() +body = sdx_lc_client.User() # User | Created user object try: # Create user @@ -69,13 +69,13 @@ Creates list of users with given input array ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() -body = [swagger_client.User()] # list[User] | List of user object +api_instance = sdx_lc_client.UserApi() +body = [sdx_lc_client.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -114,13 +114,13 @@ Creates list of users with given input array ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() -body = [swagger_client.User()] # list[User] | List of user object +api_instance = sdx_lc_client.UserApi() +body = [sdx_lc_client.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -161,12 +161,12 @@ This can only be done by the logged in user. ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = sdx_lc_client.UserApi() username = 'username_example' # str | The name that needs to be deleted try: @@ -206,12 +206,12 @@ Get user by user name ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = sdx_lc_client.UserApi() username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. try: @@ -252,12 +252,12 @@ Logs user into the system ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = sdx_lc_client.UserApi() username = 'username_example' # str | The user name for login password = 'password_example' # str | The password for login in clear text @@ -300,12 +300,12 @@ Logs out current logged in user session ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = sdx_lc_client.UserApi() try: # Logs out current logged in user session @@ -343,13 +343,13 @@ This can only be done by the logged in user. ```python from __future__ import print_function import time -import swagger_client -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() -body = swagger_client.User() # User | Updated user object +api_instance = sdx_lc_client.UserApi() +body = sdx_lc_client.User() # User | Updated user object username = 'username_example' # str | name that need to be updated try: diff --git a/setup.py b/setup.py index 4046b56..e17f439 100644 --- a/setup.py +++ b/setup.py @@ -12,8 +12,8 @@ from setuptools import find_packages, setup # noqa: H301 -NAME = "swagger-client" -VERSION = "1.0.0" +NAME = "sdx_lc_client" +VERSION = "2.0.0" # To install the library, run the following # # python setup.py install diff --git a/swagger_client/__init__.py b/swagger_client/__init__.py deleted file mode 100644 index 01db43a..0000000 --- a/swagger_client/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -# import apis into sdk package -from swagger_client.api.connection_api import ConnectionApi -from swagger_client.api.link_api import LinkApi -from swagger_client.api.node_api import NodeApi -from swagger_client.api.topology_api import TopologyApi -from swagger_client.api.user_api import UserApi - -# import ApiClient -from swagger_client.api_client import ApiClient -from swagger_client.configuration import Configuration - -# import models into sdk package -from swagger_client.models.api_response import ApiResponse -from swagger_client.models.connection import Connection -from swagger_client.models.link import Link -from swagger_client.models.link_measurement_period import LinkMeasurementPeriod -from swagger_client.models.location import Location -from swagger_client.models.node import Node -from swagger_client.models.port import Port -from swagger_client.models.service import Service -from swagger_client.models.topology import Topology -from swagger_client.models.user import User diff --git a/swagger_client/api/__init__.py b/swagger_client/api/__init__.py deleted file mode 100644 index 39322d9..0000000 --- a/swagger_client/api/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import absolute_import - -# import apis into api package -from swagger_client.api.connection_api import ConnectionApi -from swagger_client.api.link_api import LinkApi -from swagger_client.api.node_api import NodeApi -from swagger_client.api.topology_api import TopologyApi -from swagger_client.api.user_api import UserApi - -# flake8: noqa diff --git a/swagger_client/api/connection_api.py b/swagger_client/api/connection_api.py deleted file mode 100644 index 2b319f6..0000000 --- a/swagger_client/api/connection_api.py +++ /dev/null @@ -1,338 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from swagger_client.api_client import ApiClient - - -class ConnectionApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def delete_connection(self, connection_id, **kwargs): # noqa: E501 - """Delete connection order by ID # noqa: E501 - - delete a connection # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_connection(connection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str connection_id: ID of the connection that needs to be deleted (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_connection_with_http_info( - connection_id, **kwargs - ) # noqa: E501 - else: - (data) = self.delete_connection_with_http_info( - connection_id, **kwargs - ) # noqa: E501 - return data - - def delete_connection_with_http_info(self, connection_id, **kwargs): # noqa: E501 - """Delete connection order by ID # noqa: E501 - - delete a connection # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_connection_with_http_info(connection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str connection_id: ID of the connection that needs to be deleted (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["connection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_connection" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'connection_id' is set - if "connection_id" not in params or params["connection_id"] is None: - raise ValueError( - "Missing the required parameter `connection_id` when calling `delete_connection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "connection_id" in params: - path_params["connection_id"] = params["connection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/connection/{connection_id}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def getconnection_by_id(self, connection_id, **kwargs): # noqa: E501 - """Find connection by ID # noqa: E501 - - connection details # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.getconnection_by_id(connection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str connection_id: ID of connection that needs to be fetched (required) - :return: Connection - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.getconnection_by_id_with_http_info( - connection_id, **kwargs - ) # noqa: E501 - else: - (data) = self.getconnection_by_id_with_http_info( - connection_id, **kwargs - ) # noqa: E501 - return data - - def getconnection_by_id_with_http_info(self, connection_id, **kwargs): # noqa: E501 - """Find connection by ID # noqa: E501 - - connection details # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.getconnection_by_id_with_http_info(connection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str connection_id: ID of connection that needs to be fetched (required) - :return: Connection - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["connection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method getconnection_by_id" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'connection_id' is set - if "connection_id" not in params or params["connection_id"] is None: - raise ValueError( - "Missing the required parameter `connection_id` when calling `getconnection_by_id`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "connection_id" in params: - path_params["connection_id"] = params["connection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json", "application/xml"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/connection/{connection_id}", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="Connection", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def place_connection(self, body, **kwargs): # noqa: E501 - """Place an connection request from the SDX-Controller # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.place_connection(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Connection body: order placed for creating a connection (required) - :return: Connection - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.place_connection_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.place_connection_with_http_info(body, **kwargs) # noqa: E501 - return data - - def place_connection_with_http_info(self, body, **kwargs): # noqa: E501 - """Place an connection request from the SDX-Controller # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.place_connection_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Connection body: order placed for creating a connection (required) - :return: Connection - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method place_connection" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `place_connection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/conection", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="Connection", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/swagger_client/api/link_api.py b/swagger_client/api/link_api.py deleted file mode 100644 index 1c339a4..0000000 --- a/swagger_client/api/link_api.py +++ /dev/null @@ -1,410 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from swagger_client.api_client import ApiClient - - -class LinkApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def add_link(self, body, **kwargs): # noqa: E501 - """add a new link to the topology # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_link(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Link body: link object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.add_link_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.add_link_with_http_info(body, **kwargs) # noqa: E501 - return data - - def add_link_with_http_info(self, body, **kwargs): # noqa: E501 - """add a new link to the topology # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_link_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Link body: link object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_link" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `add_link`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/link", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def delete_link(self, node_id, **kwargs): # noqa: E501 - """Deletes a link # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_link(node_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int node_id: ID of link to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_link_with_http_info(node_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_link_with_http_info(node_id, **kwargs) # noqa: E501 - return data - - def delete_link_with_http_info(self, node_id, **kwargs): # noqa: E501 - """Deletes a link # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_link_with_http_info(node_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int node_id: ID of link to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["node_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_link" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'node_id' is set - if "node_id" not in params or params["node_id"] is None: - raise ValueError( - "Missing the required parameter `node_id` when calling `delete_link`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - if "node_id" in params: - query_params.append(("node_id", params["node_id"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/link", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def get_link(self, **kwargs): # noqa: E501 - """get an existing link # noqa: E501 - - ID of the link # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_link(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_link_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.get_link_with_http_info(**kwargs) # noqa: E501 - return data - - def get_link_with_http_info(self, **kwargs): # noqa: E501 - """get an existing link # noqa: E501 - - ID of the link # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_link_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_link" % key - ) - params[key] = val - del params["kwargs"] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/link", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def update_link(self, body, **kwargs): # noqa: E501 - """Update an existing link # noqa: E501 - - ID of link that needs to be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_link(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Link body: link object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.update_link_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.update_link_with_http_info(body, **kwargs) # noqa: E501 - return data - - def update_link_with_http_info(self, body, **kwargs): # noqa: E501 - """Update an existing link # noqa: E501 - - ID of link that needs to be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_link_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Link body: link object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_link" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `update_link`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/link", - "PUT", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/swagger_client/api/node_api.py b/swagger_client/api/node_api.py deleted file mode 100644 index 9555b44..0000000 --- a/swagger_client/api/node_api.py +++ /dev/null @@ -1,415 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from swagger_client.api_client import ApiClient - - -class NodeApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def add_node(self, body, **kwargs): # noqa: E501 - """add a new node to the topology # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_node(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Node body: node object that needs to be sent to the SDX LC (required) - :return: Node - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.add_node_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.add_node_with_http_info(body, **kwargs) # noqa: E501 - return data - - def add_node_with_http_info(self, body, **kwargs): # noqa: E501 - """add a new node to the topology # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_node_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Node body: node object that needs to be sent to the SDX LC (required) - :return: Node - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_node" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `add_node`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json", "text/plain"] - ) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/node", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="Node", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def delete_node(self, node_id, **kwargs): # noqa: E501 - """Deletes a node # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_node(node_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int node_id: ID of node to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_node_with_http_info(node_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_node_with_http_info(node_id, **kwargs) # noqa: E501 - return data - - def delete_node_with_http_info(self, node_id, **kwargs): # noqa: E501 - """Deletes a node # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_node_with_http_info(node_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int node_id: ID of node to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["node_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_node" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'node_id' is set - if "node_id" not in params or params["node_id"] is None: - raise ValueError( - "Missing the required parameter `node_id` when calling `delete_node`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - if "node_id" in params: - query_params.append(("node_id", params["node_id"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/node", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def get_node(self, **kwargs): # noqa: E501 - """get an existing node # noqa: E501 - - ID of the node # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_node(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_node_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.get_node_with_http_info(**kwargs) # noqa: E501 - return data - - def get_node_with_http_info(self, **kwargs): # noqa: E501 - """get an existing node # noqa: E501 - - ID of the node # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_node_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_node" % key - ) - params[key] = val - del params["kwargs"] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/node", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def update_node(self, body, **kwargs): # noqa: E501 - """Update an existing node # noqa: E501 - - ID of node that needs to be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_node(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Node body: node object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.update_node_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.update_node_with_http_info(body, **kwargs) # noqa: E501 - return data - - def update_node_with_http_info(self, body, **kwargs): # noqa: E501 - """Update an existing node # noqa: E501 - - ID of node that needs to be updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_node_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Node body: node object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_node" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `update_node`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/node", - "PUT", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/swagger_client/api/topology_api.py b/swagger_client/api/topology_api.py deleted file mode 100644 index 2205ba8..0000000 --- a/swagger_client/api/topology_api.py +++ /dev/null @@ -1,858 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from swagger_client.api_client import ApiClient - - -class TopologyApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def add_topology(self, body, **kwargs): # noqa: E501 - """Send a new topology to SDX-LC # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_topology(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Topology body: placed for adding a new topology (required) - :return: Topology - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.add_topology_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.add_topology_with_http_info(body, **kwargs) # noqa: E501 - return data - - def add_topology_with_http_info(self, body, **kwargs): # noqa: E501 - """Send a new topology to SDX-LC # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_topology_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Topology body: placed for adding a new topology (required) - :return: Topology - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_topology" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `add_topology`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="Topology", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def delete_topology(self, topology_id, **kwargs): # noqa: E501 - """Deletes a topology # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_topology(topology_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_topology_with_http_info( - topology_id, **kwargs - ) # noqa: E501 - else: - (data) = self.delete_topology_with_http_info( - topology_id, **kwargs - ) # noqa: E501 - return data - - def delete_topology_with_http_info(self, topology_id, **kwargs): # noqa: E501 - """Deletes a topology # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_topology_with_http_info(topology_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["topology_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_topology" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'topology_id' is set - if "topology_id" not in params or params["topology_id"] is None: - raise ValueError( - "Missing the required parameter `topology_id` when calling `delete_topology`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - if "topology_id" in params: - query_params.append(("topology_id", params["topology_id"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def delete_topology_version(self, topology_id, version, **kwargs): # noqa: E501 - """Deletes a topology version # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_topology_version(topology_id, version, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to return (required) - :param int version: topology version to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_topology_version_with_http_info( - topology_id, version, **kwargs - ) # noqa: E501 - else: - (data) = self.delete_topology_version_with_http_info( - topology_id, version, **kwargs - ) # noqa: E501 - return data - - def delete_topology_version_with_http_info( - self, topology_id, version, **kwargs - ): # noqa: E501 - """Deletes a topology version # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_topology_version_with_http_info(topology_id, version, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to return (required) - :param int version: topology version to delete (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["topology_id", "version"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_topology_version" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'topology_id' is set - if "topology_id" not in params or params["topology_id"] is None: - raise ValueError( - "Missing the required parameter `topology_id` when calling `delete_topology_version`" - ) # noqa: E501 - # verify the required parameter 'version' is set - if "version" not in params or params["version"] is None: - raise ValueError( - "Missing the required parameter `version` when calling `delete_topology_version`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "version" in params: - path_params["version"] = params["version"] # noqa: E501 - - query_params = [] - if "topology_id" in params: - query_params.append(("topology_id", params["topology_id"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology/{version}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def get_topology(self, **kwargs): # noqa: E501 - """get an existing topology # noqa: E501 - - ID of the topology # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_topology(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: str - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_topology_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.get_topology_with_http_info(**kwargs) # noqa: E501 - return data - - def get_topology_with_http_info(self, **kwargs): # noqa: E501 - """get an existing topology # noqa: E501 - - ID of the topology # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_topology_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: str - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_topology" % key - ) - params[key] = val - del params["kwargs"] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["text/plain"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="str", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def get_topologyby_version(self, topology_id, version, **kwargs): # noqa: E501 - """Find topology by version # noqa: E501 - - Returns a single topology # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_topologyby_version(topology_id, version, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to return (required) - :param int version: version of topology to return (required) - :return: Topology - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_topologyby_version_with_http_info( - topology_id, version, **kwargs - ) # noqa: E501 - else: - (data) = self.get_topologyby_version_with_http_info( - topology_id, version, **kwargs - ) # noqa: E501 - return data - - def get_topologyby_version_with_http_info( - self, topology_id, version, **kwargs - ): # noqa: E501 - """Find topology by version # noqa: E501 - - Returns a single topology # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_topologyby_version_with_http_info(topology_id, version, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to return (required) - :param int version: version of topology to return (required) - :return: Topology - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["topology_id", "version"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_topologyby_version" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'topology_id' is set - if "topology_id" not in params or params["topology_id"] is None: - raise ValueError( - "Missing the required parameter `topology_id` when calling `get_topologyby_version`" - ) # noqa: E501 - # verify the required parameter 'version' is set - if "version" not in params or params["version"] is None: - raise ValueError( - "Missing the required parameter `version` when calling `get_topologyby_version`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "version" in params: - path_params["version"] = params["version"] # noqa: E501 - - query_params = [] - if "topology_id" in params: - query_params.append(("topology_id", params["topology_id"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology/{version}", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="Topology", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def topology_version(self, topology_id, **kwargs): # noqa: E501 - """Finds topology version # noqa: E501 - - Topology version # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.topology_version(topology_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str topology_id: topology id (required) - :return: Topology - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.topology_version_with_http_info( - topology_id, **kwargs - ) # noqa: E501 - else: - (data) = self.topology_version_with_http_info( - topology_id, **kwargs - ) # noqa: E501 - return data - - def topology_version_with_http_info(self, topology_id, **kwargs): # noqa: E501 - """Finds topology version # noqa: E501 - - Topology version # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.topology_version_with_http_info(topology_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str topology_id: topology id (required) - :return: Topology - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["topology_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method topology_version" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'topology_id' is set - if "topology_id" not in params or params["topology_id"] is None: - raise ValueError( - "Missing the required parameter `topology_id` when calling `topology_version`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - if "topology_id" in params: - query_params.append(("topology_id", params["topology_id"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology/version", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="Topology", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def update_topology(self, body, **kwargs): # noqa: E501 - """Update an existing topology # noqa: E501 - - ID of topology that needs to be updated. \\\\ The topology update only updates the addition or deletion \\\\ of node, port, link. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_topology(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Topology body: topology object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.update_topology_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.update_topology_with_http_info(body, **kwargs) # noqa: E501 - return data - - def update_topology_with_http_info(self, body, **kwargs): # noqa: E501 - """Update an existing topology # noqa: E501 - - ID of topology that needs to be updated. \\\\ The topology update only updates the addition or deletion \\\\ of node, port, link. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_topology_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param Topology body: topology object that needs to be sent to the SDX LC (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_topology" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `update_topology`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology", - "PUT", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def upload_file(self, topology_id, **kwargs): # noqa: E501 - """uploads an topology image # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.upload_file(topology_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to update (required) - :param Object body: - :return: ApiResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_file_with_http_info(topology_id, **kwargs) # noqa: E501 - else: - (data) = self.upload_file_with_http_info( - topology_id, **kwargs - ) # noqa: E501 - return data - - def upload_file_with_http_info(self, topology_id, **kwargs): # noqa: E501 - """uploads an topology image # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.upload_file_with_http_info(topology_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int topology_id: ID of topology to update (required) - :param Object body: - :return: ApiResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["topology_id", "body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_file" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'topology_id' is set - if "topology_id" not in params or params["topology_id"] is None: - raise ValueError( - "Missing the required parameter `topology_id` when calling `upload_file`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "topology_id" in params: - path_params["topology_id"] = params["topology_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/octet-stream"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/topology/{topology_id}/uploadImage", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="ApiResponse", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/swagger_client/api/user_api.py b/swagger_client/api/user_api.py deleted file mode 100644 index 0dd9809..0000000 --- a/swagger_client/api/user_api.py +++ /dev/null @@ -1,844 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from swagger_client.api_client import ApiClient - - -class UserApi(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def create_user(self, body, **kwargs): # noqa: E501 - """Create user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_user(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param User body: Created user object (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_user_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_user_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_user_with_http_info(self, body, **kwargs): # noqa: E501 - """Create user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_user_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param User body: Created user object (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_user" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_user`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def create_users_with_array_input(self, body, **kwargs): # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_users_with_array_input(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param list[User] body: List of user object (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_users_with_array_input_with_http_info( - body, **kwargs - ) # noqa: E501 - else: - (data) = self.create_users_with_array_input_with_http_info( - body, **kwargs - ) # noqa: E501 - return data - - def create_users_with_array_input_with_http_info( - self, body, **kwargs - ): # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_users_with_array_input_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param list[User] body: List of user object (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_users_with_array_input" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_users_with_array_input`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user/createWithArray", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def create_users_with_list_input(self, body, **kwargs): # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_users_with_list_input(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param list[User] body: List of user object (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_users_with_list_input_with_http_info( - body, **kwargs - ) # noqa: E501 - else: - (data) = self.create_users_with_list_input_with_http_info( - body, **kwargs - ) # noqa: E501 - return data - - def create_users_with_list_input_with_http_info(self, body, **kwargs): # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_users_with_list_input_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param list[User] body: List of user object (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_users_with_list_input" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_users_with_list_input`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user/createWithList", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def delete_user(self, username, **kwargs): # noqa: E501 - """Delete user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_user(username, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str username: The name that needs to be deleted (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 - else: - (data) = self.delete_user_with_http_info(username, **kwargs) # noqa: E501 - return data - - def delete_user_with_http_info(self, username, **kwargs): # noqa: E501 - """Delete user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_user_with_http_info(username, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str username: The name that needs to be deleted (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["username"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_user" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'username' is set - if "username" not in params or params["username"] is None: - raise ValueError( - "Missing the required parameter `username` when calling `delete_user`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "username" in params: - path_params["username"] = params["username"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user/{username}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def get_user_by_name(self, username, **kwargs): # noqa: E501 - """Get user by user name # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_user_by_name(username, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) - :return: User - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_user_by_name_with_http_info( - username, **kwargs - ) # noqa: E501 - else: - (data) = self.get_user_by_name_with_http_info( - username, **kwargs - ) # noqa: E501 - return data - - def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 - """Get user by user name # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_user_by_name_with_http_info(username, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) - :return: User - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["username"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user_by_name" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'username' is set - if "username" not in params or params["username"] is None: - raise ValueError( - "Missing the required parameter `username` when calling `get_user_by_name`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "username" in params: - path_params["username"] = params["username"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json", "application/xml"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user/{username}", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="User", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def login_user(self, username, password, **kwargs): # noqa: E501 - """Logs user into the system # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.login_user(username, password, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str username: The user name for login (required) - :param str password: The password for login in clear text (required) - :return: str - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.login_user_with_http_info( - username, password, **kwargs - ) # noqa: E501 - else: - (data) = self.login_user_with_http_info( - username, password, **kwargs - ) # noqa: E501 - return data - - def login_user_with_http_info(self, username, password, **kwargs): # noqa: E501 - """Logs user into the system # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.login_user_with_http_info(username, password, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str username: The user name for login (required) - :param str password: The password for login in clear text (required) - :return: str - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["username", "password"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method login_user" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'username' is set - if "username" not in params or params["username"] is None: - raise ValueError( - "Missing the required parameter `username` when calling `login_user`" - ) # noqa: E501 - # verify the required parameter 'password' is set - if "password" not in params or params["password"] is None: - raise ValueError( - "Missing the required parameter `password` when calling `login_user`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - if "username" in params: - query_params.append(("username", params["username"])) # noqa: E501 - if "password" in params: - query_params.append(("password", params["password"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json", "application/xml"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user/login", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="str", # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def logout_user(self, **kwargs): # noqa: E501 - """Logs out current logged in user session # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.logout_user(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.logout_user_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.logout_user_with_http_info(**kwargs) # noqa: E501 - return data - - def logout_user_with_http_info(self, **kwargs): # noqa: E501 - """Logs out current logged in user session # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.logout_user_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method logout_user" % key - ) - params[key] = val - del params["kwargs"] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user/logout", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def update_user(self, body, username, **kwargs): # noqa: E501 - """Updated user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_user(body, username, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param User body: Updated user object (required) - :param str username: name that need to be updated (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.update_user_with_http_info( - body, username, **kwargs - ) # noqa: E501 - else: - (data) = self.update_user_with_http_info( - body, username, **kwargs - ) # noqa: E501 - return data - - def update_user_with_http_info(self, body, username, **kwargs): # noqa: E501 - """Updated user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_user_with_http_info(body, username, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param User body: Updated user object (required) - :param str username: name that need to be updated (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "username"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_user" % key - ) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `update_user`" - ) # noqa: E501 - # verify the required parameter 'username' is set - if "username" not in params or params["username"] is None: - raise ValueError( - "Missing the required parameter `username` when calling `update_user`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "username" in params: - path_params["username"] = params["username"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Content-Type` - header_params["Content-Type"] = ( - self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/user/{username}", - "PUT", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, # noqa: E501 - auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/swagger_client/api_client.py b/swagger_client/api_client.py deleted file mode 100644 index cdd6f4b..0000000 --- a/swagger_client/api_client.py +++ /dev/null @@ -1,708 +0,0 @@ -# coding: utf-8 -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" -from __future__ import absolute_import - -import datetime -import json -import mimetypes -import os -import re -import tempfile -from multiprocessing.pool import ThreadPool - -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import quote - -import swagger_client.models -from swagger_client import rest -from swagger_client.configuration import Configuration - - -class ApiClient(object): - """Generic API client for Swagger client library builds. - - Swagger generic API client. This client handles the client- - server communication, and is invariant across implementations. Specifics of - the methods and models for each application are generated from the Swagger - templates. - - NOTE: This class is auto generated by the swagger code generator program. - Ref: https://github.com/swagger-api/swagger-codegen - Do not edit the class manually. - - :param configuration: .Configuration object for this client - :param header_name: a header to pass when making calls to the API. - :param header_value: a header value to pass when making calls to - the API. - :param cookie: a cookie to include in the header when making calls - to the API - """ - - PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types - NATIVE_TYPES_MAPPING = { - "int": int, - "long": int if six.PY3 else long, # noqa: F821 - "float": float, - "str": str, - "bool": bool, - "date": datetime.date, - "datetime": datetime.datetime, - "object": object, - } - - def __init__( - self, configuration=None, header_name=None, header_value=None, cookie=None - ): - if configuration is None: - configuration = Configuration() - self.configuration = configuration - - self.pool = ThreadPool() - self.rest_client = rest.RESTClientObject(configuration) - self.default_headers = {} - if header_name is not None: - self.default_headers[header_name] = header_value - self.cookie = cookie - # Set default User-Agent. - self.user_agent = "Swagger-Codegen/1.0.0/python" - - def __del__(self): - self.pool.close() - self.pool.join() - - @property - def user_agent(self): - """User agent for this API client""" - return self.default_headers["User-Agent"] - - @user_agent.setter - def user_agent(self, value): - self.default_headers["User-Agent"] = value - - def set_default_header(self, header_name, header_value): - self.default_headers[header_name] = header_value - - def __call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - ): - config = self.configuration - - # header parameters - header_params = header_params or {} - header_params.update(self.default_headers) - if self.cookie: - header_params["Cookie"] = self.cookie - if header_params: - header_params = self.sanitize_for_serialization(header_params) - header_params = dict( - self.parameters_to_tuples(header_params, collection_formats) - ) - - # path parameters - if path_params: - path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, collection_formats) - for k, v in path_params: - # specified safe chars, encode everything - resource_path = resource_path.replace( - "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) - ) - - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, collection_formats) - - # post parameters - if post_params or files: - post_params = self.prepare_post_parameters(post_params, files) - post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, collection_formats) - - # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) - - # body - if body: - body = self.sanitize_for_serialization(body) - - # request url - url = self.configuration.host + resource_path - - # perform request and return response - response_data = self.request( - method, - url, - query_params=query_params, - headers=header_params, - post_params=post_params, - body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) - - self.last_response = response_data - - return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None - - if _return_http_data_only: - return return_data - else: - return (return_data, response_data.status, response_data.getheaders()) - - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. - - If obj is None, return None. - If obj is str, int, long, float, bool, return directly. - If obj is datetime.datetime, datetime.date - convert to string in iso8601 format. - If obj is list, sanitize each element in the list. - If obj is dict, return the dict. - If obj is swagger model, return the properties dict. - - :param obj: The data to serialize. - :return: The serialized form of data. - """ - if obj is None: - return None - elif isinstance(obj, self.PRIMITIVE_TYPES): - return obj - elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] - elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) - elif isinstance(obj, (datetime.datetime, datetime.date)): - return obj.isoformat() - - if isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `swagger_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = { - obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.swagger_types) - if getattr(obj, attr) is not None - } - - return { - key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict) - } - - def deserialize(self, response, response_type): - """Deserializes response into an object. - - :param response: RESTResponse object to be deserialized. - :param response_type: class literal for - deserialized object, or string of class name. - - :return: deserialized object. - """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) - - # fetch data from response object - try: - data = json.loads(response.data) - except ValueError: - data = response.data - - return self.__deserialize(data, response_type) - - def __deserialize(self, data, klass): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - - :return: object. - """ - if data is None: - return None - - if type(klass) == str: - if klass.startswith("list["): - sub_kls = re.match(r"list\[(.*)\]", klass).group(1) - return [self.__deserialize(sub_data, sub_kls) for sub_data in data] - - if klass.startswith("dict("): - sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2) - return { - k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data) - } - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr(swagger_client.models, klass) - - if klass in self.PRIMITIVE_TYPES: - return self.__deserialize_primitive(data, klass) - elif klass == object: - return self.__deserialize_object(data) - elif klass == datetime.date: - return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datatime(data) - else: - return self.__deserialize_model(data, klass) - - def call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - async_req=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - ): - """Makes the HTTP request (synchronous) and returns deserialized data. - - To make an async request, set the async_req parameter. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: - If async_req parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async_req is False or missing, - then the method will return the response directly. - """ - if not async_req: - return self.__call_api( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - ) - else: - thread = self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - ), - ) - return thread - - def request( - self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.GET( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "HEAD": - return self.rest_client.HEAD( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "OPTIONS": - return self.rest_client.OPTIONS( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "POST": - return self.rest_client.POST( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PUT": - return self.rest_client.PUT( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PATCH": - return self.rest_client.PATCH( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "DELETE": - return self.rest_client.DELETE( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - else: - raise ValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - - def parameters_to_tuples(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. - - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: Parameters as list of tuples, collections formatted - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in ( - six.iteritems(params) if isinstance(params, dict) else params - ): # noqa: E501 - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == "multi": - new_params.extend((k, value) for value in v) - else: - if collection_format == "ssv": - delimiter = " " - elif collection_format == "tsv": - delimiter = "\t" - elif collection_format == "pipes": - delimiter = "|" - else: # csv is the default - delimiter = "," - new_params.append((k, delimiter.join(str(value) for value in v))) - else: - new_params.append((k, v)) - return new_params - - def prepare_post_parameters(self, post_params=None, files=None): - """Builds form parameters. - - :param post_params: Normal form parameters. - :param files: File parameters. - :return: Form parameters with files. - """ - params = [] - - if post_params: - params = post_params - - if files: - for k, v in six.iteritems(files): - if not v: - continue - file_names = v if type(v) is list else [v] - for n in file_names: - with open(n, "rb") as f: - filename = os.path.basename(f.name) - filedata = f.read() - mimetype = ( - mimetypes.guess_type(filename)[0] - or "application/octet-stream" - ) - params.append(tuple([k, tuple([filename, filedata, mimetype])])) - - return params - - def select_header_accept(self, accepts): - """Returns `Accept` based on an array of accepts provided. - - :param accepts: List of headers. - :return: Accept (e.g. application/json). - """ - if not accepts: - return - - accepts = [x.lower() for x in accepts] - - if "application/json" in accepts: - return "application/json" - else: - return ", ".join(accepts) - - def select_header_content_type(self, content_types): - """Returns `Content-Type` based on an array of content_types provided. - - :param content_types: List of content-types. - :return: Content-Type (e.g. application/json). - """ - if not content_types: - return "application/json" - - content_types = [x.lower() for x in content_types] - - if "application/json" in content_types or "*/*" in content_types: - return "application/json" - else: - return content_types[0] - - def update_params_for_auth(self, headers, querys, auth_settings): - """Updates header and query params based on authentication setting. - - :param headers: Header parameters dict to be updated. - :param querys: Query parameters tuple list to be updated. - :param auth_settings: Authentication setting identifiers list. - """ - if not auth_settings: - return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - if not auth_setting["value"]: - continue - elif auth_setting["in"] == "header": - headers[auth_setting["key"]] = auth_setting["value"] - elif auth_setting["in"] == "query": - querys.append((auth_setting["key"], auth_setting["value"])) - else: - raise ValueError( - "Authentication token must be in `query` or `header`" - ) - - def __deserialize_file(self, response): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - - :param response: RESTResponse. - :return: file path. - """ - fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - content_disposition = response.getheader("Content-Disposition") - if content_disposition: - filename = re.search( - r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition - ).group(1) - path = os.path.join(os.path.dirname(path), filename) - response_data = response.data - with open(path, "wb") as f: - if isinstance(response_data, str): - # change str to bytes so we can write it - response_data = response_data.encode("utf-8") - f.write(response_data) - else: - f.write(response_data) - return path - - def __deserialize_primitive(self, data, klass): - """Deserializes string to primitive type. - - :param data: str. - :param klass: class literal. - - :return: int, long, float, str, bool. - """ - try: - return klass(data) - except UnicodeEncodeError: - return six.text_type(data) - except TypeError: - return data - - def __deserialize_object(self, value): - """Return a original value. - - :return: object. - """ - return value - - def __deserialize_date(self, string): - """Deserializes string to date. - - :param string: str. - :return: date. - """ - try: - from dateutil.parser import parse - - return parse(string).date() - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, reason="Failed to parse `{0}` as date object".format(string) - ) - - def __deserialize_datatime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - from dateutil.parser import parse - - return parse(string) - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason=("Failed to parse `{0}` as datetime object".format(string)), - ) - - def __hasattr(self, object, name): - return name in object.__class__.__dict__ - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ - - if not klass.swagger_types and not self.__hasattr( - klass, "get_real_child_model" - ): - return data - - kwargs = {} - if klass.swagger_types is not None: - for attr, attr_type in six.iteritems(klass.swagger_types): - if ( - data is not None - and klass.attribute_map[attr] in data - and isinstance(data, (list, dict)) - ): - value = data[klass.attribute_map[attr]] - kwargs[attr] = self.__deserialize(value, attr_type) - - instance = klass(**kwargs) - - if ( - isinstance(instance, dict) - and klass.swagger_types is not None - and isinstance(data, dict) - ): - for key, value in data.items(): - if key not in klass.swagger_types: - instance[key] = value - if self.__hasattr(instance, "get_real_child_model"): - klass_name = instance.get_real_child_model(data) - if klass_name: - instance = self.__deserialize(data, klass_name) - return instance diff --git a/swagger_client/configuration.py b/swagger_client/configuration.py deleted file mode 100644 index 1156ba1..0000000 --- a/swagger_client/configuration.py +++ /dev/null @@ -1,247 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import copy -import logging -import multiprocessing -import sys - -import six -import urllib3 -from six.moves import http_client as httplib - - -class TypeWithDefault(type): - def __init__(cls, name, bases, dct): - super(TypeWithDefault, cls).__init__(name, bases, dct) - cls._default = None - - def __call__(cls): - if cls._default is None: - cls._default = type.__call__(cls) - return copy.copy(cls._default) - - def set_default(cls, default): - cls._default = copy.copy(default) - - -class Configuration(six.with_metaclass(TypeWithDefault, object)): - """NOTE: This class is auto generated by the swagger code generator program. - - Ref: https://github.com/swagger-api/swagger-codegen - Do not edit the class manually. - """ - - def __init__(self): - """Constructor""" - # Default Base url - self.host = "https://virtserver.swaggerhub.com/SDX-LC/2.0.0" - # Temp file folder for downloading files - self.temp_folder_path = None - - # Authentication Settings - # dict to store API key(s) - self.api_key = {} - # dict to store API prefix (e.g. Bearer) - self.api_key_prefix = {} - # function to refresh API key if expired - self.refresh_api_key_hook = None - # Username for HTTP basic authentication - self.username = "" - # Password for HTTP basic authentication - self.password = "" - # Logging Settings - self.logger = {} - self.logger["package_logger"] = logging.getLogger("swagger_client") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - # Log format - self.logger_format = "%(asctime)s %(levelname)s %(message)s" - # Log stream handler - self.logger_stream_handler = None - # Log file handler - self.logger_file_handler = None - # Debug file location - self.logger_file = None - # Debug switch - self.debug = False - - # SSL/TLS verification - # Set this to false to skip verifying SSL certificate when calling API - # from https server. - self.verify_ssl = True - # Set this to customize the certificate file to verify the peer. - self.ssl_ca_cert = None - # client certificate file - self.cert_file = None - # client key file - self.key_file = None - # Set this to True/False to enable/disable SSL hostname verification. - self.assert_hostname = None - - # urllib3 connection pool's maximum number of connections saved - # per pool. urllib3 uses 1 connection as default value, but this is - # not the best value when you are making a lot of possibly parallel - # requests to the same host, which is often the case here. - # cpu_count * 5 is used as default value to increase performance. - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - - # Proxy URL - self.proxy = None - # Safe chars for path_param - self.safe_chars_for_path_param = "" - - @property - def logger_file(self): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - return self.__logger_file - - @logger_file.setter - def logger_file(self, value): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - self.__logger_file = value - if self.__logger_file: - # If set logging file, - # then add file handler and remove stream handler. - self.logger_file_handler = logging.FileHandler(self.__logger_file) - self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) - - @property - def debug(self): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - return self.__debug - - @debug.setter - def debug(self, value): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - self.__debug = value - if self.__debug: - # if debug status is True, turn on debug logging - for _, logger in six.iteritems(self.logger): - logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 - else: - # if debug status is False, turn off debug logging, - # setting log level to default `logging.WARNING` - for _, logger in six.iteritems(self.logger): - logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 - - @property - def logger_format(self): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - return self.__logger_format - - @logger_format.setter - def logger_format(self, value): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - self.__logger_format = value - self.logger_formatter = logging.Formatter(self.__logger_format) - - def get_api_key_with_prefix(self, identifier): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :return: The token for api key authentication. - """ - if self.refresh_api_key_hook: - self.refresh_api_key_hook(self) - - key = self.api_key.get(identifier) - if key: - prefix = self.api_key_prefix.get(identifier) - if prefix: - return "%s %s" % (prefix, key) - else: - return key - - def get_basic_auth_token(self): - """Gets HTTP basic authentication header (string). - - :return: The token for basic HTTP authentication. - """ - token = "" - if self.username or self.password: - token = urllib3.util.make_headers( - basic_auth=self.username + ":" + self.password - ).get("authorization") - return token - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - return {} - - def to_debug_report(self): - """Gets the essential information for debugging. - - :return: The report for debugging. - """ - return ( - "Python SDK Debug Report:\n" - "OS: {env}\n" - "Python Version: {pyversion}\n" - "Version of the API: 2.0.0\n" - "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) - ) diff --git a/swagger_client/models/__init__.py b/swagger_client/models/__init__.py deleted file mode 100644 index 8811059..0000000 --- a/swagger_client/models/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding: utf-8 - -# flake8: noqa -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -# import models into model package -from swagger_client.models.api_response import ApiResponse -from swagger_client.models.connection import Connection -from swagger_client.models.link import Link -from swagger_client.models.link_measurement_period import LinkMeasurementPeriod -from swagger_client.models.location import Location -from swagger_client.models.node import Node -from swagger_client.models.port import Port -from swagger_client.models.service import Service -from swagger_client.models.topology import Topology -from swagger_client.models.user import User diff --git a/swagger_client/models/api_response.py b/swagger_client/models/api_response.py deleted file mode 100644 index 4383d17..0000000 --- a/swagger_client/models/api_response.py +++ /dev/null @@ -1,160 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class ApiResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = {"code": "int", "type": "str", "message": "str"} - - attribute_map = {"code": "code", "type": "type", "message": "message"} - - def __init__(self, code=None, type=None, message=None): # noqa: E501 - """ApiResponse - a model defined in Swagger""" # noqa: E501 - self._code = None - self._type = None - self._message = None - self.discriminator = None - if code is not None: - self.code = code - if type is not None: - self.type = type - if message is not None: - self.message = message - - @property - def code(self): - """Gets the code of this ApiResponse. # noqa: E501 - - - :return: The code of this ApiResponse. # noqa: E501 - :rtype: int - """ - return self._code - - @code.setter - def code(self, code): - """Sets the code of this ApiResponse. - - - :param code: The code of this ApiResponse. # noqa: E501 - :type: int - """ - - self._code = code - - @property - def type(self): - """Gets the type of this ApiResponse. # noqa: E501 - - - :return: The type of this ApiResponse. # noqa: E501 - :rtype: str - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this ApiResponse. - - - :param type: The type of this ApiResponse. # noqa: E501 - :type: str - """ - - self._type = type - - @property - def message(self): - """Gets the message of this ApiResponse. # noqa: E501 - - - :return: The message of this ApiResponse. # noqa: E501 - :rtype: str - """ - return self._message - - @message.setter - def message(self, message): - """Sets the message of this ApiResponse. - - - :param message: The message of this ApiResponse. # noqa: E501 - :type: str - """ - - self._message = message - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(ApiResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ApiResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/connection.py b/swagger_client/models/connection.py deleted file mode 100644 index bb4c292..0000000 --- a/swagger_client/models/connection.py +++ /dev/null @@ -1,739 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class Connection(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "id": "str", - "name": "str", - "ingress_port": "Port", - "egress_port": "Port", - "quantity": "int", - "start_time": "datetime", - "end_time": "datetime", - "multi_path": "bool", - "preempt": "bool", - "backup_path_type": "str", - "exclusive_links": "list[Link]", - "inclusive_links": "list[Link]", - "bandwidth_required": "float", - "bandwidth_measured": "float", - "latency_required": "float", - "latency_measured": "float", - "packetloss_required": "float", - "packetloss_measured": "float", - "availability_required": "float", - "availability_measured": "float", - "paths": "list[str]", - "status": "str", - "complete": "bool", - } - - attribute_map = { - "id": "id", - "name": "name", - "ingress_port": "ingress_port", - "egress_port": "egress_port", - "quantity": "quantity", - "start_time": "start_time", - "end_time": "end_time", - "multi_path": "multi_path", - "preempt": "preempt", - "backup_path_type": "backup_path_type", - "exclusive_links": "exclusive_links", - "inclusive_links": "inclusive_links", - "bandwidth_required": "bandwidth_required", - "bandwidth_measured": "bandwidth_measured", - "latency_required": "latency_required", - "latency_measured": "latency_measured", - "packetloss_required": "packetloss_required", - "packetloss_measured": "packetloss_measured", - "availability_required": "availability_required", - "availability_measured": "availability_measured", - "paths": "paths", - "status": "status", - "complete": "complete", - } - - def __init__( - self, - id=None, - name=None, - ingress_port=None, - egress_port=None, - quantity=None, - start_time=None, - end_time=None, - multi_path=None, - preempt=None, - backup_path_type=None, - exclusive_links=None, - inclusive_links=None, - bandwidth_required=None, - bandwidth_measured=None, - latency_required=None, - latency_measured=None, - packetloss_required=None, - packetloss_measured=None, - availability_required=None, - availability_measured=None, - paths=None, - status=None, - complete=False, - ): # noqa: E501 - """Connection - a model defined in Swagger""" # noqa: E501 - self._id = None - self._name = None - self._ingress_port = None - self._egress_port = None - self._quantity = None - self._start_time = None - self._end_time = None - self._multi_path = None - self._preempt = None - self._backup_path_type = None - self._exclusive_links = None - self._inclusive_links = None - self._bandwidth_required = None - self._bandwidth_measured = None - self._latency_required = None - self._latency_measured = None - self._packetloss_required = None - self._packetloss_measured = None - self._availability_required = None - self._availability_measured = None - self._paths = None - self._status = None - self._complete = None - self.discriminator = None - self.id = id - self.name = name - self.ingress_port = ingress_port - self.egress_port = egress_port - if quantity is not None: - self.quantity = quantity - if start_time is not None: - self.start_time = start_time - if end_time is not None: - self.end_time = end_time - if multi_path is not None: - self.multi_path = multi_path - if preempt is not None: - self.preempt = preempt - if backup_path_type is not None: - self.backup_path_type = backup_path_type - if exclusive_links is not None: - self.exclusive_links = exclusive_links - if inclusive_links is not None: - self.inclusive_links = inclusive_links - if bandwidth_required is not None: - self.bandwidth_required = bandwidth_required - if bandwidth_measured is not None: - self.bandwidth_measured = bandwidth_measured - if latency_required is not None: - self.latency_required = latency_required - if latency_measured is not None: - self.latency_measured = latency_measured - if packetloss_required is not None: - self.packetloss_required = packetloss_required - if packetloss_measured is not None: - self.packetloss_measured = packetloss_measured - if availability_required is not None: - self.availability_required = availability_required - if availability_measured is not None: - self.availability_measured = availability_measured - if paths is not None: - self.paths = paths - if status is not None: - self.status = status - if complete is not None: - self.complete = complete - - @property - def id(self): - """Gets the id of this Connection. # noqa: E501 - - - :return: The id of this Connection. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Connection. - - - :param id: The id of this Connection. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this Connection. # noqa: E501 - - - :return: The name of this Connection. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Connection. - - - :param name: The name of this Connection. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 - - self._name = name - - @property - def ingress_port(self): - """Gets the ingress_port of this Connection. # noqa: E501 - - - :return: The ingress_port of this Connection. # noqa: E501 - :rtype: Port - """ - return self._ingress_port - - @ingress_port.setter - def ingress_port(self, ingress_port): - """Sets the ingress_port of this Connection. - - - :param ingress_port: The ingress_port of this Connection. # noqa: E501 - :type: Port - """ - if ingress_port is None: - raise ValueError( - "Invalid value for `ingress_port`, must not be `None`" - ) # noqa: E501 - - self._ingress_port = ingress_port - - @property - def egress_port(self): - """Gets the egress_port of this Connection. # noqa: E501 - - - :return: The egress_port of this Connection. # noqa: E501 - :rtype: Port - """ - return self._egress_port - - @egress_port.setter - def egress_port(self, egress_port): - """Sets the egress_port of this Connection. - - - :param egress_port: The egress_port of this Connection. # noqa: E501 - :type: Port - """ - if egress_port is None: - raise ValueError( - "Invalid value for `egress_port`, must not be `None`" - ) # noqa: E501 - - self._egress_port = egress_port - - @property - def quantity(self): - """Gets the quantity of this Connection. # noqa: E501 - - - :return: The quantity of this Connection. # noqa: E501 - :rtype: int - """ - return self._quantity - - @quantity.setter - def quantity(self, quantity): - """Sets the quantity of this Connection. - - - :param quantity: The quantity of this Connection. # noqa: E501 - :type: int - """ - - self._quantity = quantity - - @property - def start_time(self): - """Gets the start_time of this Connection. # noqa: E501 - - - :return: The start_time of this Connection. # noqa: E501 - :rtype: datetime - """ - return self._start_time - - @start_time.setter - def start_time(self, start_time): - """Sets the start_time of this Connection. - - - :param start_time: The start_time of this Connection. # noqa: E501 - :type: datetime - """ - - self._start_time = start_time - - @property - def end_time(self): - """Gets the end_time of this Connection. # noqa: E501 - - - :return: The end_time of this Connection. # noqa: E501 - :rtype: datetime - """ - return self._end_time - - @end_time.setter - def end_time(self, end_time): - """Sets the end_time of this Connection. - - - :param end_time: The end_time of this Connection. # noqa: E501 - :type: datetime - """ - - self._end_time = end_time - - @property - def multi_path(self): - """Gets the multi_path of this Connection. # noqa: E501 - - - :return: The multi_path of this Connection. # noqa: E501 - :rtype: bool - """ - return self._multi_path - - @multi_path.setter - def multi_path(self, multi_path): - """Sets the multi_path of this Connection. - - - :param multi_path: The multi_path of this Connection. # noqa: E501 - :type: bool - """ - - self._multi_path = multi_path - - @property - def preempt(self): - """Gets the preempt of this Connection. # noqa: E501 - - - :return: The preempt of this Connection. # noqa: E501 - :rtype: bool - """ - return self._preempt - - @preempt.setter - def preempt(self, preempt): - """Sets the preempt of this Connection. - - - :param preempt: The preempt of this Connection. # noqa: E501 - :type: bool - """ - - self._preempt = preempt - - @property - def backup_path_type(self): - """Gets the backup_path_type of this Connection. # noqa: E501 - - - :return: The backup_path_type of this Connection. # noqa: E501 - :rtype: str - """ - return self._backup_path_type - - @backup_path_type.setter - def backup_path_type(self, backup_path_type): - """Sets the backup_path_type of this Connection. - - - :param backup_path_type: The backup_path_type of this Connection. # noqa: E501 - :type: str - """ - allowed_values = ["0", "1", "2", "3"] # noqa: E501 - if backup_path_type not in allowed_values: - raise ValueError( - "Invalid value for `backup_path_type` ({0}), must be one of {1}".format( # noqa: E501 - backup_path_type, allowed_values - ) - ) - - self._backup_path_type = backup_path_type - - @property - def exclusive_links(self): - """Gets the exclusive_links of this Connection. # noqa: E501 - - - :return: The exclusive_links of this Connection. # noqa: E501 - :rtype: list[Link] - """ - return self._exclusive_links - - @exclusive_links.setter - def exclusive_links(self, exclusive_links): - """Sets the exclusive_links of this Connection. - - - :param exclusive_links: The exclusive_links of this Connection. # noqa: E501 - :type: list[Link] - """ - - self._exclusive_links = exclusive_links - - @property - def inclusive_links(self): - """Gets the inclusive_links of this Connection. # noqa: E501 - - - :return: The inclusive_links of this Connection. # noqa: E501 - :rtype: list[Link] - """ - return self._inclusive_links - - @inclusive_links.setter - def inclusive_links(self, inclusive_links): - """Sets the inclusive_links of this Connection. - - - :param inclusive_links: The inclusive_links of this Connection. # noqa: E501 - :type: list[Link] - """ - - self._inclusive_links = inclusive_links - - @property - def bandwidth_required(self): - """Gets the bandwidth_required of this Connection. # noqa: E501 - - - :return: The bandwidth_required of this Connection. # noqa: E501 - :rtype: float - """ - return self._bandwidth_required - - @bandwidth_required.setter - def bandwidth_required(self, bandwidth_required): - """Sets the bandwidth_required of this Connection. - - - :param bandwidth_required: The bandwidth_required of this Connection. # noqa: E501 - :type: float - """ - - self._bandwidth_required = bandwidth_required - - @property - def bandwidth_measured(self): - """Gets the bandwidth_measured of this Connection. # noqa: E501 - - - :return: The bandwidth_measured of this Connection. # noqa: E501 - :rtype: float - """ - return self._bandwidth_measured - - @bandwidth_measured.setter - def bandwidth_measured(self, bandwidth_measured): - """Sets the bandwidth_measured of this Connection. - - - :param bandwidth_measured: The bandwidth_measured of this Connection. # noqa: E501 - :type: float - """ - - self._bandwidth_measured = bandwidth_measured - - @property - def latency_required(self): - """Gets the latency_required of this Connection. # noqa: E501 - - - :return: The latency_required of this Connection. # noqa: E501 - :rtype: float - """ - return self._latency_required - - @latency_required.setter - def latency_required(self, latency_required): - """Sets the latency_required of this Connection. - - - :param latency_required: The latency_required of this Connection. # noqa: E501 - :type: float - """ - - self._latency_required = latency_required - - @property - def latency_measured(self): - """Gets the latency_measured of this Connection. # noqa: E501 - - - :return: The latency_measured of this Connection. # noqa: E501 - :rtype: float - """ - return self._latency_measured - - @latency_measured.setter - def latency_measured(self, latency_measured): - """Sets the latency_measured of this Connection. - - - :param latency_measured: The latency_measured of this Connection. # noqa: E501 - :type: float - """ - - self._latency_measured = latency_measured - - @property - def packetloss_required(self): - """Gets the packetloss_required of this Connection. # noqa: E501 - - - :return: The packetloss_required of this Connection. # noqa: E501 - :rtype: float - """ - return self._packetloss_required - - @packetloss_required.setter - def packetloss_required(self, packetloss_required): - """Sets the packetloss_required of this Connection. - - - :param packetloss_required: The packetloss_required of this Connection. # noqa: E501 - :type: float - """ - - self._packetloss_required = packetloss_required - - @property - def packetloss_measured(self): - """Gets the packetloss_measured of this Connection. # noqa: E501 - - - :return: The packetloss_measured of this Connection. # noqa: E501 - :rtype: float - """ - return self._packetloss_measured - - @packetloss_measured.setter - def packetloss_measured(self, packetloss_measured): - """Sets the packetloss_measured of this Connection. - - - :param packetloss_measured: The packetloss_measured of this Connection. # noqa: E501 - :type: float - """ - - self._packetloss_measured = packetloss_measured - - @property - def availability_required(self): - """Gets the availability_required of this Connection. # noqa: E501 - - - :return: The availability_required of this Connection. # noqa: E501 - :rtype: float - """ - return self._availability_required - - @availability_required.setter - def availability_required(self, availability_required): - """Sets the availability_required of this Connection. - - - :param availability_required: The availability_required of this Connection. # noqa: E501 - :type: float - """ - - self._availability_required = availability_required - - @property - def availability_measured(self): - """Gets the availability_measured of this Connection. # noqa: E501 - - - :return: The availability_measured of this Connection. # noqa: E501 - :rtype: float - """ - return self._availability_measured - - @availability_measured.setter - def availability_measured(self, availability_measured): - """Sets the availability_measured of this Connection. - - - :param availability_measured: The availability_measured of this Connection. # noqa: E501 - :type: float - """ - - self._availability_measured = availability_measured - - @property - def paths(self): - """Gets the paths of this Connection. # noqa: E501 - - - :return: The paths of this Connection. # noqa: E501 - :rtype: list[str] - """ - return self._paths - - @paths.setter - def paths(self, paths): - """Sets the paths of this Connection. - - - :param paths: The paths of this Connection. # noqa: E501 - :type: list[str] - """ - - self._paths = paths - - @property - def status(self): - """Gets the status of this Connection. # noqa: E501 - - Connection Status # noqa: E501 - - :return: The status of this Connection. # noqa: E501 - :rtype: str - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this Connection. - - Connection Status # noqa: E501 - - :param status: The status of this Connection. # noqa: E501 - :type: str - """ - allowed_values = ["success", "fail", "scheduled", "provisioining"] # noqa: E501 - if status not in allowed_values: - raise ValueError( - "Invalid value for `status` ({0}), must be one of {1}".format( # noqa: E501 - status, allowed_values - ) - ) - - self._status = status - - @property - def complete(self): - """Gets the complete of this Connection. # noqa: E501 - - - :return: The complete of this Connection. # noqa: E501 - :rtype: bool - """ - return self._complete - - @complete.setter - def complete(self, complete): - """Sets the complete of this Connection. - - - :param complete: The complete of this Connection. # noqa: E501 - :type: bool - """ - - self._complete = complete - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(Connection, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Connection): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/link.py b/swagger_client/models/link.py deleted file mode 100644 index d8b1166..0000000 --- a/swagger_client/models/link.py +++ /dev/null @@ -1,477 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class Link(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "id": "str", - "name": "str", - "short_name": "str", - "ports": "list[Port]", - "bandwidth": "float", - "residual_bandwidth": "float", - "latency": "float", - "packet_loss": "float", - "availability": "float", - "status": "str", - "state": "str", - "private_attributes": "list[str]", - "timestamp": "datetime", - "measurement_period": "LinkMeasurementPeriod", - } - - attribute_map = { - "id": "id", - "name": "name", - "short_name": "short_name", - "ports": "ports", - "bandwidth": "bandwidth", - "residual_bandwidth": "residual_bandwidth", - "latency": "latency", - "packet_loss": "packet_loss", - "availability": "availability", - "status": "status", - "state": "state", - "private_attributes": "private_attributes", - "timestamp": "timestamp", - "measurement_period": "measurement_period", - } - - def __init__( - self, - id=None, - name=None, - short_name=None, - ports=None, - bandwidth=None, - residual_bandwidth=None, - latency=None, - packet_loss=None, - availability=None, - status=None, - state=None, - private_attributes=None, - timestamp=None, - measurement_period=None, - ): # noqa: E501 - """Link - a model defined in Swagger""" # noqa: E501 - self._id = None - self._name = None - self._short_name = None - self._ports = None - self._bandwidth = None - self._residual_bandwidth = None - self._latency = None - self._packet_loss = None - self._availability = None - self._status = None - self._state = None - self._private_attributes = None - self._timestamp = None - self._measurement_period = None - self.discriminator = None - self.id = id - self.name = name - if short_name is not None: - self.short_name = short_name - self.ports = ports - if bandwidth is not None: - self.bandwidth = bandwidth - if residual_bandwidth is not None: - self.residual_bandwidth = residual_bandwidth - if latency is not None: - self.latency = latency - if packet_loss is not None: - self.packet_loss = packet_loss - if availability is not None: - self.availability = availability - if status is not None: - self.status = status - if state is not None: - self.state = state - if private_attributes is not None: - self.private_attributes = private_attributes - if timestamp is not None: - self.timestamp = timestamp - if measurement_period is not None: - self.measurement_period = measurement_period - - @property - def id(self): - """Gets the id of this Link. # noqa: E501 - - - :return: The id of this Link. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Link. - - - :param id: The id of this Link. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this Link. # noqa: E501 - - - :return: The name of this Link. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Link. - - - :param name: The name of this Link. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 - - self._name = name - - @property - def short_name(self): - """Gets the short_name of this Link. # noqa: E501 - - - :return: The short_name of this Link. # noqa: E501 - :rtype: str - """ - return self._short_name - - @short_name.setter - def short_name(self, short_name): - """Sets the short_name of this Link. - - - :param short_name: The short_name of this Link. # noqa: E501 - :type: str - """ - - self._short_name = short_name - - @property - def ports(self): - """Gets the ports of this Link. # noqa: E501 - - - :return: The ports of this Link. # noqa: E501 - :rtype: list[Port] - """ - return self._ports - - @ports.setter - def ports(self, ports): - """Sets the ports of this Link. - - - :param ports: The ports of this Link. # noqa: E501 - :type: list[Port] - """ - if ports is None: - raise ValueError( - "Invalid value for `ports`, must not be `None`" - ) # noqa: E501 - - self._ports = ports - - @property - def bandwidth(self): - """Gets the bandwidth of this Link. # noqa: E501 - - - :return: The bandwidth of this Link. # noqa: E501 - :rtype: float - """ - return self._bandwidth - - @bandwidth.setter - def bandwidth(self, bandwidth): - """Sets the bandwidth of this Link. - - - :param bandwidth: The bandwidth of this Link. # noqa: E501 - :type: float - """ - - self._bandwidth = bandwidth - - @property - def residual_bandwidth(self): - """Gets the residual_bandwidth of this Link. # noqa: E501 - - - :return: The residual_bandwidth of this Link. # noqa: E501 - :rtype: float - """ - return self._residual_bandwidth - - @residual_bandwidth.setter - def residual_bandwidth(self, residual_bandwidth): - """Sets the residual_bandwidth of this Link. - - - :param residual_bandwidth: The residual_bandwidth of this Link. # noqa: E501 - :type: float - """ - - self._residual_bandwidth = residual_bandwidth - - @property - def latency(self): - """Gets the latency of this Link. # noqa: E501 - - - :return: The latency of this Link. # noqa: E501 - :rtype: float - """ - return self._latency - - @latency.setter - def latency(self, latency): - """Sets the latency of this Link. - - - :param latency: The latency of this Link. # noqa: E501 - :type: float - """ - - self._latency = latency - - @property - def packet_loss(self): - """Gets the packet_loss of this Link. # noqa: E501 - - - :return: The packet_loss of this Link. # noqa: E501 - :rtype: float - """ - return self._packet_loss - - @packet_loss.setter - def packet_loss(self, packet_loss): - """Sets the packet_loss of this Link. - - - :param packet_loss: The packet_loss of this Link. # noqa: E501 - :type: float - """ - - self._packet_loss = packet_loss - - @property - def availability(self): - """Gets the availability of this Link. # noqa: E501 - - - :return: The availability of this Link. # noqa: E501 - :rtype: float - """ - return self._availability - - @availability.setter - def availability(self, availability): - """Sets the availability of this Link. - - - :param availability: The availability of this Link. # noqa: E501 - :type: float - """ - - self._availability = availability - - @property - def status(self): - """Gets the status of this Link. # noqa: E501 - - - :return: The status of this Link. # noqa: E501 - :rtype: str - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this Link. - - - :param status: The status of this Link. # noqa: E501 - :type: str - """ - - self._status = status - - @property - def state(self): - """Gets the state of this Link. # noqa: E501 - - - :return: The state of this Link. # noqa: E501 - :rtype: str - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this Link. - - - :param state: The state of this Link. # noqa: E501 - :type: str - """ - - self._state = state - - @property - def private_attributes(self): - """Gets the private_attributes of this Link. # noqa: E501 - - - :return: The private_attributes of this Link. # noqa: E501 - :rtype: list[str] - """ - return self._private_attributes - - @private_attributes.setter - def private_attributes(self, private_attributes): - """Sets the private_attributes of this Link. - - - :param private_attributes: The private_attributes of this Link. # noqa: E501 - :type: list[str] - """ - - self._private_attributes = private_attributes - - @property - def timestamp(self): - """Gets the timestamp of this Link. # noqa: E501 - - - :return: The timestamp of this Link. # noqa: E501 - :rtype: datetime - """ - return self._timestamp - - @timestamp.setter - def timestamp(self, timestamp): - """Sets the timestamp of this Link. - - - :param timestamp: The timestamp of this Link. # noqa: E501 - :type: datetime - """ - - self._timestamp = timestamp - - @property - def measurement_period(self): - """Gets the measurement_period of this Link. # noqa: E501 - - - :return: The measurement_period of this Link. # noqa: E501 - :rtype: LinkMeasurementPeriod - """ - return self._measurement_period - - @measurement_period.setter - def measurement_period(self, measurement_period): - """Sets the measurement_period of this Link. - - - :param measurement_period: The measurement_period of this Link. # noqa: E501 - :type: LinkMeasurementPeriod - """ - - self._measurement_period = measurement_period - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(Link, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Link): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/link_measurement_period.py b/swagger_client/models/link_measurement_period.py deleted file mode 100644 index bf5cef4..0000000 --- a/swagger_client/models/link_measurement_period.py +++ /dev/null @@ -1,136 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class LinkMeasurementPeriod(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = {"period": "float", "time_unit": "str"} - - attribute_map = {"period": "period", "time_unit": "time_unit"} - - def __init__(self, period=None, time_unit=None): # noqa: E501 - """LinkMeasurementPeriod - a model defined in Swagger""" # noqa: E501 - self._period = None - self._time_unit = None - self.discriminator = None - if period is not None: - self.period = period - if time_unit is not None: - self.time_unit = time_unit - - @property - def period(self): - """Gets the period of this LinkMeasurementPeriod. # noqa: E501 - - - :return: The period of this LinkMeasurementPeriod. # noqa: E501 - :rtype: float - """ - return self._period - - @period.setter - def period(self, period): - """Sets the period of this LinkMeasurementPeriod. - - - :param period: The period of this LinkMeasurementPeriod. # noqa: E501 - :type: float - """ - - self._period = period - - @property - def time_unit(self): - """Gets the time_unit of this LinkMeasurementPeriod. # noqa: E501 - - - :return: The time_unit of this LinkMeasurementPeriod. # noqa: E501 - :rtype: str - """ - return self._time_unit - - @time_unit.setter - def time_unit(self, time_unit): - """Sets the time_unit of this LinkMeasurementPeriod. - - - :param time_unit: The time_unit of this LinkMeasurementPeriod. # noqa: E501 - :type: str - """ - - self._time_unit = time_unit - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(LinkMeasurementPeriod, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, LinkMeasurementPeriod): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/location.py b/swagger_client/models/location.py deleted file mode 100644 index f4f34af..0000000 --- a/swagger_client/models/location.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class Location(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "address": "str", - "latitude": "float", - "longitude": "float", - "iso3166_2_lvl4": "str", - } - - attribute_map = { - "address": "address", - "latitude": "latitude", - "longitude": "longitude", - "iso3166_2_lvl4": "iso3166_2_lvl4", - } - - def __init__( - self, address=None, latitude=None, longitude=None, iso3166_2_lvl4=None - ): # noqa: E501 - """Location - a model defined in Swagger""" # noqa: E501 - self._address = None - self._latitude = None - self._longitude = None - self._iso3166_2_lvl4 = None - self.discriminator = None - if address is not None: - self.address = address - if latitude is not None: - self.latitude = latitude - if longitude is not None: - self.longitude = longitude - if iso3166_2_lvl4 is not None: - self.iso3166_2_lvl4 = iso3166_2_lvl4 - - @property - def address(self): - """Gets the address of this Location. # noqa: E501 - - - :return: The address of this Location. # noqa: E501 - :rtype: str - """ - return self._address - - @address.setter - def address(self, address): - """Sets the address of this Location. - - - :param address: The address of this Location. # noqa: E501 - :type: str - """ - - self._address = address - - @property - def latitude(self): - """Gets the latitude of this Location. # noqa: E501 - - - :return: The latitude of this Location. # noqa: E501 - :rtype: float - """ - return self._latitude - - @latitude.setter - def latitude(self, latitude): - """Sets the latitude of this Location. - - - :param latitude: The latitude of this Location. # noqa: E501 - :type: float - """ - - self._latitude = latitude - - @property - def longitude(self): - """Gets the longitude of this Location. # noqa: E501 - - - :return: The longitude of this Location. # noqa: E501 - :rtype: float - """ - return self._longitude - - @longitude.setter - def longitude(self, longitude): - """Sets the longitude of this Location. - - - :param longitude: The longitude of this Location. # noqa: E501 - :type: float - """ - - self._longitude = longitude - - @property - def iso3166_2_lvl4(self): - """Gets the iso3166_2_lvl4 of this Location. # noqa: E501 - - - :return: The iso3166_2_lvl4 of this Location. # noqa: E501 - :rtype: str - """ - return self._iso3166_2_lvl4 - - @iso3166_2_lvl4.setter - def iso3166_2_lvl4(self, iso3166_2_lvl4): - """Sets the iso3166_2_lvl4 of this Location. - - - :param iso3166_2_lvl4: The iso3166_2_lvl4 of this Location. # noqa: E501 - :type: str - """ - - self._iso3166_2_lvl4 = iso3166_2_lvl4 - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(Location, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Location): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/node.py b/swagger_client/models/node.py deleted file mode 100644 index a4ae60a..0000000 --- a/swagger_client/models/node.py +++ /dev/null @@ -1,264 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class Node(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "id": "str", - "name": "str", - "short_name": "str", - "location": "Location", - "ports": "list[Port]", - "private_attributes": "list[str]", - } - - attribute_map = { - "id": "id", - "name": "name", - "short_name": "short_name", - "location": "location", - "ports": "ports", - "private_attributes": "private_attributes", - } - - def __init__( - self, - id=None, - name=None, - short_name=None, - location=None, - ports=None, - private_attributes=None, - ): # noqa: E501 - """Node - a model defined in Swagger""" # noqa: E501 - self._id = None - self._name = None - self._short_name = None - self._location = None - self._ports = None - self._private_attributes = None - self.discriminator = None - self.id = id - self.name = name - if short_name is not None: - self.short_name = short_name - self.location = location - self.ports = ports - if private_attributes is not None: - self.private_attributes = private_attributes - - @property - def id(self): - """Gets the id of this Node. # noqa: E501 - - - :return: The id of this Node. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Node. - - - :param id: The id of this Node. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this Node. # noqa: E501 - - - :return: The name of this Node. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Node. - - - :param name: The name of this Node. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 - - self._name = name - - @property - def short_name(self): - """Gets the short_name of this Node. # noqa: E501 - - - :return: The short_name of this Node. # noqa: E501 - :rtype: str - """ - return self._short_name - - @short_name.setter - def short_name(self, short_name): - """Sets the short_name of this Node. - - - :param short_name: The short_name of this Node. # noqa: E501 - :type: str - """ - - self._short_name = short_name - - @property - def location(self): - """Gets the location of this Node. # noqa: E501 - - - :return: The location of this Node. # noqa: E501 - :rtype: Location - """ - return self._location - - @location.setter - def location(self, location): - """Sets the location of this Node. - - - :param location: The location of this Node. # noqa: E501 - :type: Location - """ - if location is None: - raise ValueError( - "Invalid value for `location`, must not be `None`" - ) # noqa: E501 - - self._location = location - - @property - def ports(self): - """Gets the ports of this Node. # noqa: E501 - - - :return: The ports of this Node. # noqa: E501 - :rtype: list[Port] - """ - return self._ports - - @ports.setter - def ports(self, ports): - """Sets the ports of this Node. - - - :param ports: The ports of this Node. # noqa: E501 - :type: list[Port] - """ - if ports is None: - raise ValueError( - "Invalid value for `ports`, must not be `None`" - ) # noqa: E501 - - self._ports = ports - - @property - def private_attributes(self): - """Gets the private_attributes of this Node. # noqa: E501 - - - :return: The private_attributes of this Node. # noqa: E501 - :rtype: list[str] - """ - return self._private_attributes - - @private_attributes.setter - def private_attributes(self, private_attributes): - """Sets the private_attributes of this Node. - - - :param private_attributes: The private_attributes of this Node. # noqa: E501 - :type: list[str] - """ - - self._private_attributes = private_attributes - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(Node, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Node): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/port.py b/swagger_client/models/port.py deleted file mode 100644 index 2df73e2..0000000 --- a/swagger_client/models/port.py +++ /dev/null @@ -1,345 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class Port(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "id": "str", - "name": "str", - "short_name": "str", - "node": "str", - "label_range": "list[str]", - "status": "str", - "state": "str", - "services": "Service", - "private_attributes": "list[str]", - } - - attribute_map = { - "id": "id", - "name": "name", - "short_name": "short_name", - "node": "node", - "label_range": "label_range", - "status": "status", - "state": "state", - "services": "services", - "private_attributes": "private_attributes", - } - - def __init__( - self, - id=None, - name=None, - short_name=None, - node=None, - label_range=None, - status=None, - state=None, - services=None, - private_attributes=None, - ): # noqa: E501 - """Port - a model defined in Swagger""" # noqa: E501 - self._id = None - self._name = None - self._short_name = None - self._node = None - self._label_range = None - self._status = None - self._state = None - self._services = None - self._private_attributes = None - self.discriminator = None - self.id = id - self.name = name - if short_name is not None: - self.short_name = short_name - self.node = node - if label_range is not None: - self.label_range = label_range - self.status = status - if state is not None: - self.state = state - if services is not None: - self.services = services - if private_attributes is not None: - self.private_attributes = private_attributes - - @property - def id(self): - """Gets the id of this Port. # noqa: E501 - - - :return: The id of this Port. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Port. - - - :param id: The id of this Port. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this Port. # noqa: E501 - - - :return: The name of this Port. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Port. - - - :param name: The name of this Port. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 - - self._name = name - - @property - def short_name(self): - """Gets the short_name of this Port. # noqa: E501 - - - :return: The short_name of this Port. # noqa: E501 - :rtype: str - """ - return self._short_name - - @short_name.setter - def short_name(self, short_name): - """Sets the short_name of this Port. - - - :param short_name: The short_name of this Port. # noqa: E501 - :type: str - """ - - self._short_name = short_name - - @property - def node(self): - """Gets the node of this Port. # noqa: E501 - - - :return: The node of this Port. # noqa: E501 - :rtype: str - """ - return self._node - - @node.setter - def node(self, node): - """Sets the node of this Port. - - - :param node: The node of this Port. # noqa: E501 - :type: str - """ - if node is None: - raise ValueError( - "Invalid value for `node`, must not be `None`" - ) # noqa: E501 - - self._node = node - - @property - def label_range(self): - """Gets the label_range of this Port. # noqa: E501 - - - :return: The label_range of this Port. # noqa: E501 - :rtype: list[str] - """ - return self._label_range - - @label_range.setter - def label_range(self, label_range): - """Sets the label_range of this Port. - - - :param label_range: The label_range of this Port. # noqa: E501 - :type: list[str] - """ - - self._label_range = label_range - - @property - def status(self): - """Gets the status of this Port. # noqa: E501 - - - :return: The status of this Port. # noqa: E501 - :rtype: str - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this Port. - - - :param status: The status of this Port. # noqa: E501 - :type: str - """ - if status is None: - raise ValueError( - "Invalid value for `status`, must not be `None`" - ) # noqa: E501 - - self._status = status - - @property - def state(self): - """Gets the state of this Port. # noqa: E501 - - - :return: The state of this Port. # noqa: E501 - :rtype: str - """ - return self._state - - @state.setter - def state(self, state): - """Sets the state of this Port. - - - :param state: The state of this Port. # noqa: E501 - :type: str - """ - - self._state = state - - @property - def services(self): - """Gets the services of this Port. # noqa: E501 - - - :return: The services of this Port. # noqa: E501 - :rtype: Service - """ - return self._services - - @services.setter - def services(self, services): - """Sets the services of this Port. - - - :param services: The services of this Port. # noqa: E501 - :type: Service - """ - - self._services = services - - @property - def private_attributes(self): - """Gets the private_attributes of this Port. # noqa: E501 - - - :return: The private_attributes of this Port. # noqa: E501 - :rtype: list[str] - """ - return self._private_attributes - - @private_attributes.setter - def private_attributes(self, private_attributes): - """Sets the private_attributes of this Port. - - - :param private_attributes: The private_attributes of this Port. # noqa: E501 - :type: list[str] - """ - - self._private_attributes = private_attributes - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(Port, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Port): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/service.py b/swagger_client/models/service.py deleted file mode 100644 index 1a5a2d4..0000000 --- a/swagger_client/models/service.py +++ /dev/null @@ -1,308 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class Service(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "l2vpn_ptp": "object", - "l2vpn_ptmp": "object", - "monitoring_capability": "str", - "owner": "str", - "private_attributes": "list[str]", - "provisioning_system": "str", - "provisioning_url": "str", - "vendor": "list[str]", - } - - attribute_map = { - "l2vpn_ptp": "l2vpn-ptp", - "l2vpn_ptmp": "l2vpn-ptmp", - "monitoring_capability": "monitoring_capability", - "owner": "owner", - "private_attributes": "private_attributes", - "provisioning_system": "provisioning_system", - "provisioning_url": "provisioning_url", - "vendor": "vendor", - } - - def __init__( - self, - l2vpn_ptp=None, - l2vpn_ptmp=None, - monitoring_capability=None, - owner=None, - private_attributes=None, - provisioning_system=None, - provisioning_url=None, - vendor=None, - ): # noqa: E501 - """Service - a model defined in Swagger""" # noqa: E501 - self._l2vpn_ptp = None - self._l2vpn_ptmp = None - self._monitoring_capability = None - self._owner = None - self._private_attributes = None - self._provisioning_system = None - self._provisioning_url = None - self._vendor = None - self.discriminator = None - if l2vpn_ptp is not None: - self.l2vpn_ptp = l2vpn_ptp - if l2vpn_ptmp is not None: - self.l2vpn_ptmp = l2vpn_ptmp - if monitoring_capability is not None: - self.monitoring_capability = monitoring_capability - if owner is not None: - self.owner = owner - if private_attributes is not None: - self.private_attributes = private_attributes - if provisioning_system is not None: - self.provisioning_system = provisioning_system - if provisioning_url is not None: - self.provisioning_url = provisioning_url - if vendor is not None: - self.vendor = vendor - - @property - def l2vpn_ptp(self): - """Gets the l2vpn_ptp of this Service. # noqa: E501 - - - :return: The l2vpn_ptp of this Service. # noqa: E501 - :rtype: object - """ - return self._l2vpn_ptp - - @l2vpn_ptp.setter - def l2vpn_ptp(self, l2vpn_ptp): - """Sets the l2vpn_ptp of this Service. - - - :param l2vpn_ptp: The l2vpn_ptp of this Service. # noqa: E501 - :type: object - """ - - self._l2vpn_ptp = l2vpn_ptp - - @property - def l2vpn_ptmp(self): - """Gets the l2vpn_ptmp of this Service. # noqa: E501 - - - :return: The l2vpn_ptmp of this Service. # noqa: E501 - :rtype: object - """ - return self._l2vpn_ptmp - - @l2vpn_ptmp.setter - def l2vpn_ptmp(self, l2vpn_ptmp): - """Sets the l2vpn_ptmp of this Service. - - - :param l2vpn_ptmp: The l2vpn_ptmp of this Service. # noqa: E501 - :type: object - """ - - self._l2vpn_ptmp = l2vpn_ptmp - - @property - def monitoring_capability(self): - """Gets the monitoring_capability of this Service. # noqa: E501 - - - :return: The monitoring_capability of this Service. # noqa: E501 - :rtype: str - """ - return self._monitoring_capability - - @monitoring_capability.setter - def monitoring_capability(self, monitoring_capability): - """Sets the monitoring_capability of this Service. - - - :param monitoring_capability: The monitoring_capability of this Service. # noqa: E501 - :type: str - """ - - self._monitoring_capability = monitoring_capability - - @property - def owner(self): - """Gets the owner of this Service. # noqa: E501 - - - :return: The owner of this Service. # noqa: E501 - :rtype: str - """ - return self._owner - - @owner.setter - def owner(self, owner): - """Sets the owner of this Service. - - - :param owner: The owner of this Service. # noqa: E501 - :type: str - """ - - self._owner = owner - - @property - def private_attributes(self): - """Gets the private_attributes of this Service. # noqa: E501 - - - :return: The private_attributes of this Service. # noqa: E501 - :rtype: list[str] - """ - return self._private_attributes - - @private_attributes.setter - def private_attributes(self, private_attributes): - """Sets the private_attributes of this Service. - - - :param private_attributes: The private_attributes of this Service. # noqa: E501 - :type: list[str] - """ - - self._private_attributes = private_attributes - - @property - def provisioning_system(self): - """Gets the provisioning_system of this Service. # noqa: E501 - - - :return: The provisioning_system of this Service. # noqa: E501 - :rtype: str - """ - return self._provisioning_system - - @provisioning_system.setter - def provisioning_system(self, provisioning_system): - """Sets the provisioning_system of this Service. - - - :param provisioning_system: The provisioning_system of this Service. # noqa: E501 - :type: str - """ - - self._provisioning_system = provisioning_system - - @property - def provisioning_url(self): - """Gets the provisioning_url of this Service. # noqa: E501 - - - :return: The provisioning_url of this Service. # noqa: E501 - :rtype: str - """ - return self._provisioning_url - - @provisioning_url.setter - def provisioning_url(self, provisioning_url): - """Sets the provisioning_url of this Service. - - - :param provisioning_url: The provisioning_url of this Service. # noqa: E501 - :type: str - """ - - self._provisioning_url = provisioning_url - - @property - def vendor(self): - """Gets the vendor of this Service. # noqa: E501 - - - :return: The vendor of this Service. # noqa: E501 - :rtype: list[str] - """ - return self._vendor - - @vendor.setter - def vendor(self, vendor): - """Sets the vendor of this Service. - - - :param vendor: The vendor of this Service. # noqa: E501 - :type: list[str] - """ - - self._vendor = vendor - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(Service, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Service): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/topology.py b/swagger_client/models/topology.py deleted file mode 100644 index b03a36f..0000000 --- a/swagger_client/models/topology.py +++ /dev/null @@ -1,351 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class Topology(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "id": "str", - "name": "str", - "services": "Service", - "version": "int", - "model_version": "str", - "timestamp": "datetime", - "nodes": "list[Node]", - "links": "list[Link]", - "private_attributes": "list[str]", - } - - attribute_map = { - "id": "id", - "name": "name", - "services": "services", - "version": "version", - "model_version": "model_version", - "timestamp": "timestamp", - "nodes": "nodes", - "links": "links", - "private_attributes": "private_attributes", - } - - def __init__( - self, - id=None, - name=None, - services=None, - version=None, - model_version=None, - timestamp=None, - nodes=None, - links=None, - private_attributes=None, - ): # noqa: E501 - """Topology - a model defined in Swagger""" # noqa: E501 - self._id = None - self._name = None - self._services = None - self._version = None - self._model_version = None - self._timestamp = None - self._nodes = None - self._links = None - self._private_attributes = None - self.discriminator = None - self.id = id - self.name = name - if services is not None: - self.services = services - self.version = version - if model_version is not None: - self.model_version = model_version - self.timestamp = timestamp - self.nodes = nodes - self.links = links - if private_attributes is not None: - self.private_attributes = private_attributes - - @property - def id(self): - """Gets the id of this Topology. # noqa: E501 - - - :return: The id of this Topology. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Topology. - - - :param id: The id of this Topology. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def name(self): - """Gets the name of this Topology. # noqa: E501 - - - :return: The name of this Topology. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Topology. - - - :param name: The name of this Topology. # noqa: E501 - :type: str - """ - if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) # noqa: E501 - - self._name = name - - @property - def services(self): - """Gets the services of this Topology. # noqa: E501 - - - :return: The services of this Topology. # noqa: E501 - :rtype: Service - """ - return self._services - - @services.setter - def services(self, services): - """Sets the services of this Topology. - - - :param services: The services of this Topology. # noqa: E501 - :type: Service - """ - - self._services = services - - @property - def version(self): - """Gets the version of this Topology. # noqa: E501 - - - :return: The version of this Topology. # noqa: E501 - :rtype: int - """ - return self._version - - @version.setter - def version(self, version): - """Sets the version of this Topology. - - - :param version: The version of this Topology. # noqa: E501 - :type: int - """ - if version is None: - raise ValueError( - "Invalid value for `version`, must not be `None`" - ) # noqa: E501 - - self._version = version - - @property - def model_version(self): - """Gets the model_version of this Topology. # noqa: E501 - - - :return: The model_version of this Topology. # noqa: E501 - :rtype: str - """ - return self._model_version - - @model_version.setter - def model_version(self, model_version): - """Sets the model_version of this Topology. - - - :param model_version: The model_version of this Topology. # noqa: E501 - :type: str - """ - - self._model_version = model_version - - @property - def timestamp(self): - """Gets the timestamp of this Topology. # noqa: E501 - - - :return: The timestamp of this Topology. # noqa: E501 - :rtype: datetime - """ - return self._timestamp - - @timestamp.setter - def timestamp(self, timestamp): - """Sets the timestamp of this Topology. - - - :param timestamp: The timestamp of this Topology. # noqa: E501 - :type: datetime - """ - if timestamp is None: - raise ValueError( - "Invalid value for `timestamp`, must not be `None`" - ) # noqa: E501 - - self._timestamp = timestamp - - @property - def nodes(self): - """Gets the nodes of this Topology. # noqa: E501 - - - :return: The nodes of this Topology. # noqa: E501 - :rtype: list[Node] - """ - return self._nodes - - @nodes.setter - def nodes(self, nodes): - """Sets the nodes of this Topology. - - - :param nodes: The nodes of this Topology. # noqa: E501 - :type: list[Node] - """ - if nodes is None: - raise ValueError( - "Invalid value for `nodes`, must not be `None`" - ) # noqa: E501 - - self._nodes = nodes - - @property - def links(self): - """Gets the links of this Topology. # noqa: E501 - - - :return: The links of this Topology. # noqa: E501 - :rtype: list[Link] - """ - return self._links - - @links.setter - def links(self, links): - """Sets the links of this Topology. - - - :param links: The links of this Topology. # noqa: E501 - :type: list[Link] - """ - if links is None: - raise ValueError( - "Invalid value for `links`, must not be `None`" - ) # noqa: E501 - - self._links = links - - @property - def private_attributes(self): - """Gets the private_attributes of this Topology. # noqa: E501 - - - :return: The private_attributes of this Topology. # noqa: E501 - :rtype: list[str] - """ - return self._private_attributes - - @private_attributes.setter - def private_attributes(self, private_attributes): - """Sets the private_attributes of this Topology. - - - :param private_attributes: The private_attributes of this Topology. # noqa: E501 - :type: list[str] - """ - - self._private_attributes = private_attributes - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(Topology, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Topology): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/models/user.py b/swagger_client/models/user.py deleted file mode 100644 index 307e188..0000000 --- a/swagger_client/models/user.py +++ /dev/null @@ -1,310 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - - -class User(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "id": "int", - "username": "str", - "first_name": "str", - "last_name": "str", - "email": "str", - "password": "str", - "phone": "str", - "user_status": "int", - } - - attribute_map = { - "id": "id", - "username": "username", - "first_name": "firstName", - "last_name": "lastName", - "email": "email", - "password": "password", - "phone": "phone", - "user_status": "userStatus", - } - - def __init__( - self, - id=None, - username=None, - first_name=None, - last_name=None, - email=None, - password=None, - phone=None, - user_status=None, - ): # noqa: E501 - """User - a model defined in Swagger""" # noqa: E501 - self._id = None - self._username = None - self._first_name = None - self._last_name = None - self._email = None - self._password = None - self._phone = None - self._user_status = None - self.discriminator = None - if id is not None: - self.id = id - if username is not None: - self.username = username - if first_name is not None: - self.first_name = first_name - if last_name is not None: - self.last_name = last_name - if email is not None: - self.email = email - if password is not None: - self.password = password - if phone is not None: - self.phone = phone - if user_status is not None: - self.user_status = user_status - - @property - def id(self): - """Gets the id of this User. # noqa: E501 - - - :return: The id of this User. # noqa: E501 - :rtype: int - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this User. - - - :param id: The id of this User. # noqa: E501 - :type: int - """ - - self._id = id - - @property - def username(self): - """Gets the username of this User. # noqa: E501 - - - :return: The username of this User. # noqa: E501 - :rtype: str - """ - return self._username - - @username.setter - def username(self, username): - """Sets the username of this User. - - - :param username: The username of this User. # noqa: E501 - :type: str - """ - - self._username = username - - @property - def first_name(self): - """Gets the first_name of this User. # noqa: E501 - - - :return: The first_name of this User. # noqa: E501 - :rtype: str - """ - return self._first_name - - @first_name.setter - def first_name(self, first_name): - """Sets the first_name of this User. - - - :param first_name: The first_name of this User. # noqa: E501 - :type: str - """ - - self._first_name = first_name - - @property - def last_name(self): - """Gets the last_name of this User. # noqa: E501 - - - :return: The last_name of this User. # noqa: E501 - :rtype: str - """ - return self._last_name - - @last_name.setter - def last_name(self, last_name): - """Sets the last_name of this User. - - - :param last_name: The last_name of this User. # noqa: E501 - :type: str - """ - - self._last_name = last_name - - @property - def email(self): - """Gets the email of this User. # noqa: E501 - - - :return: The email of this User. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this User. - - - :param email: The email of this User. # noqa: E501 - :type: str - """ - - self._email = email - - @property - def password(self): - """Gets the password of this User. # noqa: E501 - - - :return: The password of this User. # noqa: E501 - :rtype: str - """ - return self._password - - @password.setter - def password(self, password): - """Sets the password of this User. - - - :param password: The password of this User. # noqa: E501 - :type: str - """ - - self._password = password - - @property - def phone(self): - """Gets the phone of this User. # noqa: E501 - - - :return: The phone of this User. # noqa: E501 - :rtype: str - """ - return self._phone - - @phone.setter - def phone(self, phone): - """Sets the phone of this User. - - - :param phone: The phone of this User. # noqa: E501 - :type: str - """ - - self._phone = phone - - @property - def user_status(self): - """Gets the user_status of this User. # noqa: E501 - - User Status # noqa: E501 - - :return: The user_status of this User. # noqa: E501 - :rtype: int - """ - return self._user_status - - @user_status.setter - def user_status(self, user_status): - """Sets the user_status of this User. - - User Status # noqa: E501 - - :param user_status: The user_status of this User. # noqa: E501 - :type: int - """ - - self._user_status = user_status - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item - ), - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(User, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, User): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/swagger_client/rest.py b/swagger_client/rest.py deleted file mode 100644 index 87ec24d..0000000 --- a/swagger_client/rest.py +++ /dev/null @@ -1,409 +0,0 @@ -# coding: utf-8 - -""" - SDX LC - - You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - - OpenAPI spec version: 2.0.0 - Contact: yxin@renci.org - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -from __future__ import absolute_import - -import io -import json -import logging -import re -import ssl - -import certifi - -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import urlencode - -try: - import urllib3 -except ImportError: - raise ImportError("Swagger python client requires urllib3.") - - -logger = logging.getLogger(__name__) - - -class RESTResponse(io.IOBase): - def __init__(self, resp): - self.urllib3_response = resp - self.status = resp.status - self.reason = resp.reason - self.data = resp.data - - def getheaders(self): - """Returns a dictionary of the response headers.""" - return self.urllib3_response.headers - - def getheader(self, name, default=None): - """Returns a given response header.""" - return self.urllib3_response.headers.get(name, default) - - -class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=None): - # urllib3.PoolManager will pass all kw parameters to connectionpool - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 - # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 - - # cert_reqs - if configuration.verify_ssl: - cert_reqs = ssl.CERT_REQUIRED - else: - cert_reqs = ssl.CERT_NONE - - # ca_certs - if configuration.ssl_ca_cert: - ca_certs = configuration.ssl_ca_cert - else: - # if not set certificate file, use Mozilla's root certificates. - ca_certs = certifi.where() - - addition_pool_args = {} - if configuration.assert_hostname is not None: - addition_pool_args["assert_hostname"] = ( - configuration.assert_hostname - ) # noqa: E501 - - if maxsize is None: - if configuration.connection_pool_maxsize is not None: - maxsize = configuration.connection_pool_maxsize - else: - maxsize = 4 - - # https pool manager - if configuration.proxy: - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - **addition_pool_args - ) - else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) - - def request( - self, - method, - url, - query_params=None, - headers=None, - body=None, - post_params=None, - _preload_content=True, - _request_timeout=None, - ): - """Perform requests. - - :param method: http request method - :param url: http request url - :param query_params: query parameters in the url - :param headers: http request headers - :param body: request json body, for `application/json` - :param post_params: request post parameters, - `application/x-www-form-urlencoded` - and `multipart/form-data` - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - """ - method = method.upper() - assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] - - if post_params and body: - raise ValueError( - "body parameter cannot be used with post_params parameter." - ) - - post_params = post_params or {} - headers = headers or {} - - timeout = None - if _request_timeout: - if isinstance( - _request_timeout, (int,) if six.PY3 else (int, long) - ): # noqa: E501,F821 - timeout = urllib3.Timeout(total=_request_timeout) - elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: - timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1] - ) - - if "Content-Type" not in headers: - headers["Content-Type"] = "application/json" - - try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: - if query_params: - url += "?" + urlencode(query_params) - if re.search("json", headers["Content-Type"], re.IGNORECASE): - request_body = "{}" - if body is not None: - request_body = json.dumps(body) - r = self.pool_manager.request( - method, - url, - body=request_body, - preload_content=_preload_content, - timeout=timeout, - headers=headers, - ) - elif ( - headers["Content-Type"] == "application/x-www-form-urlencoded" - ): # noqa: E501 - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=False, - preload_content=_preload_content, - timeout=timeout, - headers=headers, - ) - elif headers["Content-Type"] == "multipart/form-data": - # must del headers['Content-Type'], or the correct - # Content-Type which generated by urllib3 will be - # overwritten. - del headers["Content-Type"] - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=True, - preload_content=_preload_content, - timeout=timeout, - headers=headers, - ) - # Pass a `string` parameter directly in the body to support - # other content types than Json when `body` argument is - # provided in serialized form - elif isinstance(body, str): - request_body = body - r = self.pool_manager.request( - method, - url, - body=request_body, - preload_content=_preload_content, - timeout=timeout, - headers=headers, - ) - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise ApiException(status=0, reason=msg) - # For `GET`, `HEAD` - else: - r = self.pool_manager.request( - method, - url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers, - ) - except urllib3.exceptions.SSLError as e: - msg = "{0}\n{1}".format(type(e).__name__, str(e)) - raise ApiException(status=0, reason=msg) - - if _preload_content: - r = RESTResponse(r) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) - - return r - - def GET( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def HEAD( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def OPTIONS( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def DELETE( - self, - url, - headers=None, - query_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def POST( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PUT( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PATCH( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - -class ApiException(Exception): - def __init__(self, status=None, reason=None, http_resp=None): - if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format(self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) - - return error_message diff --git a/test/test_api_response.py b/test/test_api_response.py index 675b061..5394e2d 100644 --- a/test/test_api_response.py +++ b/test/test_api_response.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.api_response import ApiResponse # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.api_response import ApiResponse # noqa: E501 +from sdx_lc_client.rest import ApiException class TestApiResponse(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testApiResponse(self): """Test ApiResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_response.ApiResponse() # noqa: E501 + # model = sdx_lc_client.models.api_response.ApiResponse() # noqa: E501 pass diff --git a/test/test_connection.py b/test/test_connection.py index bc95dc4..4409996 100644 --- a/test/test_connection.py +++ b/test/test_connection.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.connection import Connection # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.connection import Connection # noqa: E501 +from sdx_lc_client.rest import ApiException class TestConnection(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testConnection(self): """Test Connection""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.connection.Connection() # noqa: E501 + # model = sdx_lc_client.models.connection.Connection() # noqa: E501 pass diff --git a/test/test_connection_api.py b/test/test_connection_api.py index eca4ce5..9305ef3 100644 --- a/test/test_connection_api.py +++ b/test/test_connection_api.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.api.connection_api import ConnectionApi # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.api.connection_api import ConnectionApi # noqa: E501 +from sdx_lc_client.rest import ApiException class TestConnectionApi(unittest.TestCase): diff --git a/test/test_link.py b/test/test_link.py index 571b08d..10c22b2 100644 --- a/test/test_link.py +++ b/test/test_link.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.link import Link # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.link import Link # noqa: E501 +from sdx_lc_client.rest import ApiException class TestLink(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testLink(self): """Test Link""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.link.Link() # noqa: E501 + # model = sdx_lc_client.models.link.Link() # noqa: E501 pass diff --git a/test/test_link_api.py b/test/test_link_api.py index 41999ec..58bca71 100644 --- a/test/test_link_api.py +++ b/test/test_link_api.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.api.link_api import LinkApi # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.api.link_api import LinkApi # noqa: E501 +from sdx_lc_client.rest import ApiException class TestLinkApi(unittest.TestCase): diff --git a/test/test_link_measurement_period.py b/test/test_link_measurement_period.py index c304f83..ad644ad 100644 --- a/test/test_link_measurement_period.py +++ b/test/test_link_measurement_period.py @@ -14,11 +14,11 @@ import unittest -import swagger_client -from swagger_client.models.link_measurement_period import ( +import sdx_lc_client +from sdx_lc_client.models.link_measurement_period import ( LinkMeasurementPeriod, ) # noqa: E501 -from swagger_client.rest import ApiException +from sdx_lc_client.rest import ApiException class TestLinkMeasurementPeriod(unittest.TestCase): @@ -33,7 +33,7 @@ def tearDown(self): def testLinkMeasurementPeriod(self): """Test LinkMeasurementPeriod""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.link_measurement_period.LinkMeasurementPeriod() # noqa: E501 + # model = sdx_lc_client.models.link_measurement_period.LinkMeasurementPeriod() # noqa: E501 pass diff --git a/test/test_location.py b/test/test_location.py index b28e06d..653dfaf 100644 --- a/test/test_location.py +++ b/test/test_location.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.location import Location # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.location import Location # noqa: E501 +from sdx_lc_client.rest import ApiException class TestLocation(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testLocation(self): """Test Location""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.location.Location() # noqa: E501 + # model = sdx_lc_client.models.location.Location() # noqa: E501 pass diff --git a/test/test_node.py b/test/test_node.py index 09be635..a2a745b 100644 --- a/test/test_node.py +++ b/test/test_node.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.node import Node # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.node import Node # noqa: E501 +from sdx_lc_client.rest import ApiException class TestNode(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testNode(self): """Test Node""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.node.Node() # noqa: E501 + # model = sdx_lc_client.models.node.Node() # noqa: E501 pass diff --git a/test/test_node_api.py b/test/test_node_api.py index ec65ed0..b293633 100644 --- a/test/test_node_api.py +++ b/test/test_node_api.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.api.node_api import NodeApi # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.api.node_api import NodeApi # noqa: E501 +from sdx_lc_client.rest import ApiException class TestNodeApi(unittest.TestCase): diff --git a/test/test_port.py b/test/test_port.py index 42a45b7..0b8f7a8 100644 --- a/test/test_port.py +++ b/test/test_port.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.port import Port # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.port import Port # noqa: E501 +from sdx_lc_client.rest import ApiException class TestPort(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testPort(self): """Test Port""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.port.Port() # noqa: E501 + # model = sdx_lc_client.models.port.Port() # noqa: E501 pass diff --git a/test/test_service.py b/test/test_service.py index df79ead..893449d 100644 --- a/test/test_service.py +++ b/test/test_service.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.service import Service # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.service import Service # noqa: E501 +from sdx_lc_client.rest import ApiException class TestService(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testService(self): """Test Service""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.service.Service() # noqa: E501 + # model = sdx_lc_client.models.service.Service() # noqa: E501 pass diff --git a/test/test_topology.py b/test/test_topology.py index 2ca2668..b4f567f 100644 --- a/test/test_topology.py +++ b/test/test_topology.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.topology import Topology # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.topology import Topology # noqa: E501 +from sdx_lc_client.rest import ApiException class TestTopology(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testTopology(self): """Test Topology""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.topology.Topology() # noqa: E501 + # model = sdx_lc_client.models.topology.Topology() # noqa: E501 pass diff --git a/test/test_topology_api.py b/test/test_topology_api.py index e456bbf..67769b6 100644 --- a/test/test_topology_api.py +++ b/test/test_topology_api.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.api.topology_api import TopologyApi # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.api.topology_api import TopologyApi # noqa: E501 +from sdx_lc_client.rest import ApiException class TestTopologyApi(unittest.TestCase): diff --git a/test/test_user.py b/test/test_user.py index fea440a..6dac879 100644 --- a/test/test_user.py +++ b/test/test_user.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.models.user import User # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.models.user import User # noqa: E501 +from sdx_lc_client.rest import ApiException class TestUser(unittest.TestCase): @@ -31,7 +31,7 @@ def tearDown(self): def testUser(self): """Test User""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.user.User() # noqa: E501 + # model = sdx_lc_client.models.user.User() # noqa: E501 pass diff --git a/test/test_user_api.py b/test/test_user_api.py index 1bfb1ee..0086f1f 100644 --- a/test/test_user_api.py +++ b/test/test_user_api.py @@ -14,9 +14,9 @@ import unittest -import swagger_client -from swagger_client.api.user_api import UserApi # noqa: E501 -from swagger_client.rest import ApiException +import sdx_lc_client +from sdx_lc_client.api.user_api import UserApi # noqa: E501 +from sdx_lc_client.rest import ApiException class TestUserApi(unittest.TestCase): From 3bca8fb2c24037c7052f0ed6d619c6cfcc0fe0bd Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 16:26:10 -0400 Subject: [PATCH 06/13] tox --- .github/workflows/test.yml | 2 +- tox.ini | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 02e7563..e860285 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,7 +70,7 @@ jobs: git clone https://github.com/atlanticwave-sdx/sdx-lc.git /tmp/sdx-lc cd /tmp/sdx-lc pip install -r requirements.txt - python -m swagger_server & + python -m sdx_lc & env: SDX_MQ_IP: 'localhost' SDXLC_HOST: 'localhost' diff --git a/tox.ini b/tox.ini index a310bec..2515162 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,6 @@ envlist = py3 deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands= - nosetests \ - [] +passenv = SDXLC_* +commands = + pytest --cov=sdx_lc_client_client {posargs} From e77c49db0aa1b1bc199b3af5e05b348b5cfda4db Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 16:31:30 -0400 Subject: [PATCH 07/13] tox typo --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 2515162..55e9524 100644 --- a/tox.ini +++ b/tox.ini @@ -7,4 +7,4 @@ deps=-r{toxinidir}/requirements.txt passenv = SDXLC_* commands = - pytest --cov=sdx_lc_client_client {posargs} + pytest --cov=sdx_lc_client {posargs} From 9fb8daff71aee01d9dc87156e12f77a577dddf1e Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 16:46:37 -0400 Subject: [PATCH 08/13] test --- sdx_lc_client/.DS_Store | Bin 0 -> 6148 bytes sdx_lc_client/__init__.py | 38 + sdx_lc_client/api/__init__.py | 10 + sdx_lc_client/api/connection_api.py | 338 +++++++ sdx_lc_client/api/link_api.py | 410 +++++++++ sdx_lc_client/api/node_api.py | 415 +++++++++ sdx_lc_client/api/topology_api.py | 858 ++++++++++++++++++ sdx_lc_client/api/user_api.py | 844 +++++++++++++++++ sdx_lc_client/api_client.py | 709 +++++++++++++++ sdx_lc_client/configuration.py | 247 +++++ sdx_lc_client/models/__init__.py | 26 + sdx_lc_client/models/api_response.py | 160 ++++ sdx_lc_client/models/connection.py | 739 +++++++++++++++ sdx_lc_client/models/link.py | 477 ++++++++++ .../models/link_measurement_period.py | 136 +++ sdx_lc_client/models/location.py | 196 ++++ sdx_lc_client/models/node.py | 264 ++++++ sdx_lc_client/models/port.py | 345 +++++++ sdx_lc_client/models/service.py | 308 +++++++ sdx_lc_client/models/topology.py | 351 +++++++ sdx_lc_client/models/user.py | 310 +++++++ sdx_lc_client/rest.py | 412 +++++++++ 22 files changed, 7593 insertions(+) create mode 100644 sdx_lc_client/.DS_Store create mode 100644 sdx_lc_client/__init__.py create mode 100644 sdx_lc_client/api/__init__.py create mode 100644 sdx_lc_client/api/connection_api.py create mode 100644 sdx_lc_client/api/link_api.py create mode 100644 sdx_lc_client/api/node_api.py create mode 100644 sdx_lc_client/api/topology_api.py create mode 100644 sdx_lc_client/api/user_api.py create mode 100644 sdx_lc_client/api_client.py create mode 100644 sdx_lc_client/configuration.py create mode 100644 sdx_lc_client/models/__init__.py create mode 100644 sdx_lc_client/models/api_response.py create mode 100644 sdx_lc_client/models/connection.py create mode 100644 sdx_lc_client/models/link.py create mode 100644 sdx_lc_client/models/link_measurement_period.py create mode 100644 sdx_lc_client/models/location.py create mode 100644 sdx_lc_client/models/node.py create mode 100644 sdx_lc_client/models/port.py create mode 100644 sdx_lc_client/models/service.py create mode 100644 sdx_lc_client/models/topology.py create mode 100644 sdx_lc_client/models/user.py create mode 100644 sdx_lc_client/rest.py diff --git a/sdx_lc_client/.DS_Store b/sdx_lc_client/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c43ee62a22d53cc75b181ee2096e26474c200495 GIT binary patch literal 6148 zcmeHKI|>3p3{6x-u(7n9D|mxJ^aNf&bnRBQ5c{n>mq+vEgCMJoU?VS(yqQeiEc=Sh zMnrUdZB`-+5t+da_=qr~nmsDq!D-0ynIQeV~6j5PSpxPLOuP+Gh!1u>`Ot z_JPR2G^oI!YK|BhbmU9c)xw_p_5UsW z!~FkB;*JVXfxl8fC!5`7jaSOvI(RwjwFSP1Tg@GAhP6`=yd49*9b;qdc* Wn%Da;(5S$#6?gza5EYvM literal 0 HcmV?d00001 diff --git a/sdx_lc_client/__init__.py b/sdx_lc_client/__init__.py new file mode 100644 index 0000000..beb9d34 --- /dev/null +++ b/sdx_lc_client/__init__.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +# flake8: noqa + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +# import apis into sdk package +from sdx_lc_client.api.connection_api import ConnectionApi +from sdx_lc_client.api.link_api import LinkApi +from sdx_lc_client.api.node_api import NodeApi +from sdx_lc_client.api.topology_api import TopologyApi +from sdx_lc_client.api.user_api import UserApi + +# import ApiClient +from sdx_lc_client.api_client import ApiClient +from sdx_lc_client.configuration import Configuration + +# import models into sdk package +from sdx_lc_client.models.api_response import ApiResponse +from sdx_lc_client.models.connection import Connection +from sdx_lc_client.models.link import Link +from sdx_lc_client.models.link_measurement_period import LinkMeasurementPeriod +from sdx_lc_client.models.location import Location +from sdx_lc_client.models.node import Node +from sdx_lc_client.models.port import Port +from sdx_lc_client.models.service import Service +from sdx_lc_client.models.topology import Topology +from sdx_lc_client.models.user import User diff --git a/sdx_lc_client/api/__init__.py b/sdx_lc_client/api/__init__.py new file mode 100644 index 0000000..0f3bd11 --- /dev/null +++ b/sdx_lc_client/api/__init__.py @@ -0,0 +1,10 @@ +from __future__ import absolute_import + +# import apis into api package +from sdx_lc_client.api.connection_api import ConnectionApi +from sdx_lc_client.api.link_api import LinkApi +from sdx_lc_client.api.node_api import NodeApi +from sdx_lc_client.api.topology_api import TopologyApi +from sdx_lc_client.api.user_api import UserApi + +# flake8: noqa diff --git a/sdx_lc_client/api/connection_api.py b/sdx_lc_client/api/connection_api.py new file mode 100644 index 0000000..a8b582b --- /dev/null +++ b/sdx_lc_client/api/connection_api.py @@ -0,0 +1,338 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from sdx_lc_client.api_client import ApiClient + + +class ConnectionApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_connection(self, connection_id, **kwargs): # noqa: E501 + """Delete connection order by ID # noqa: E501 + + delete a connection # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_connection(connection_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str connection_id: ID of the connection that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.delete_connection_with_http_info( + connection_id, **kwargs + ) # noqa: E501 + else: + (data) = self.delete_connection_with_http_info( + connection_id, **kwargs + ) # noqa: E501 + return data + + def delete_connection_with_http_info(self, connection_id, **kwargs): # noqa: E501 + """Delete connection order by ID # noqa: E501 + + delete a connection # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_connection_with_http_info(connection_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str connection_id: ID of the connection that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["connection_id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_connection" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'connection_id' is set + if "connection_id" not in params or params["connection_id"] is None: + raise ValueError( + "Missing the required parameter `connection_id` when calling `delete_connection`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "connection_id" in params: + path_params["connection_id"] = params["connection_id"] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/connection/{connection_id}", + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def getconnection_by_id(self, connection_id, **kwargs): # noqa: E501 + """Find connection by ID # noqa: E501 + + connection details # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.getconnection_by_id(connection_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str connection_id: ID of connection that needs to be fetched (required) + :return: Connection + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.getconnection_by_id_with_http_info( + connection_id, **kwargs + ) # noqa: E501 + else: + (data) = self.getconnection_by_id_with_http_info( + connection_id, **kwargs + ) # noqa: E501 + return data + + def getconnection_by_id_with_http_info(self, connection_id, **kwargs): # noqa: E501 + """Find connection by ID # noqa: E501 + + connection details # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.getconnection_by_id_with_http_info(connection_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str connection_id: ID of connection that needs to be fetched (required) + :return: Connection + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["connection_id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method getconnection_by_id" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'connection_id' is set + if "connection_id" not in params or params["connection_id"] is None: + raise ValueError( + "Missing the required parameter `connection_id` when calling `getconnection_by_id`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "connection_id" in params: + path_params["connection_id"] = params["connection_id"] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json", "application/xml"] + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/connection/{connection_id}", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Connection", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def place_connection(self, body, **kwargs): # noqa: E501 + """Place an connection request from the SDX-Controller # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.place_connection(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Connection body: order placed for creating a connection (required) + :return: Connection + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.place_connection_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.place_connection_with_http_info(body, **kwargs) # noqa: E501 + return data + + def place_connection_with_http_info(self, body, **kwargs): # noqa: E501 + """Place an connection request from the SDX-Controller # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.place_connection_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Connection body: order placed for creating a connection (required) + :return: Connection + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method place_connection" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `place_connection`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 + + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/conection", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Connection", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/sdx_lc_client/api/link_api.py b/sdx_lc_client/api/link_api.py new file mode 100644 index 0000000..6c98610 --- /dev/null +++ b/sdx_lc_client/api/link_api.py @@ -0,0 +1,410 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from sdx_lc_client.api_client import ApiClient + + +class LinkApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_link(self, body, **kwargs): # noqa: E501 + """add a new link to the topology # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_link(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Link body: link object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.add_link_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.add_link_with_http_info(body, **kwargs) # noqa: E501 + return data + + def add_link_with_http_info(self, body, **kwargs): # noqa: E501 + """add a new link to the topology # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_link_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Link body: link object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_link" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `add_link`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/link", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def delete_link(self, node_id, **kwargs): # noqa: E501 + """Deletes a link # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_link(node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int node_id: ID of link to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.delete_link_with_http_info(node_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_link_with_http_info(node_id, **kwargs) # noqa: E501 + return data + + def delete_link_with_http_info(self, node_id, **kwargs): # noqa: E501 + """Deletes a link # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_link_with_http_info(node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int node_id: ID of link to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["node_id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_link" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'node_id' is set + if "node_id" not in params or params["node_id"] is None: + raise ValueError( + "Missing the required parameter `node_id` when calling `delete_link`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if "node_id" in params: + query_params.append(("node_id", params["node_id"])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/link", + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def get_link(self, **kwargs): # noqa: E501 + """get an existing link # noqa: E501 + + ID of the link # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_link(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.get_link_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_link_with_http_info(**kwargs) # noqa: E501 + return data + + def get_link_with_http_info(self, **kwargs): # noqa: E501 + """get an existing link # noqa: E501 + + ID of the link # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_link_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_link" % key + ) + params[key] = val + del params["kwargs"] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/link", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def update_link(self, body, **kwargs): # noqa: E501 + """Update an existing link # noqa: E501 + + ID of link that needs to be updated. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_link(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Link body: link object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.update_link_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.update_link_with_http_info(body, **kwargs) # noqa: E501 + return data + + def update_link_with_http_info(self, body, **kwargs): # noqa: E501 + """Update an existing link # noqa: E501 + + ID of link that needs to be updated. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_link_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Link body: link object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_link" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `update_link`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/link", + "PUT", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/sdx_lc_client/api/node_api.py b/sdx_lc_client/api/node_api.py new file mode 100644 index 0000000..b2652cb --- /dev/null +++ b/sdx_lc_client/api/node_api.py @@ -0,0 +1,415 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from sdx_lc_client.api_client import ApiClient + + +class NodeApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_node(self, body, **kwargs): # noqa: E501 + """add a new node to the topology # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_node(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Node body: node object that needs to be sent to the SDX LC (required) + :return: Node + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.add_node_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.add_node_with_http_info(body, **kwargs) # noqa: E501 + return data + + def add_node_with_http_info(self, body, **kwargs): # noqa: E501 + """add a new node to the topology # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_node_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Node body: node object that needs to be sent to the SDX LC (required) + :return: Node + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_node" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `add_node`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json", "text/plain"] + ) # noqa: E501 + + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/node", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Node", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def delete_node(self, node_id, **kwargs): # noqa: E501 + """Deletes a node # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_node(node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int node_id: ID of node to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.delete_node_with_http_info(node_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_node_with_http_info(node_id, **kwargs) # noqa: E501 + return data + + def delete_node_with_http_info(self, node_id, **kwargs): # noqa: E501 + """Deletes a node # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_node_with_http_info(node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int node_id: ID of node to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["node_id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_node" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'node_id' is set + if "node_id" not in params or params["node_id"] is None: + raise ValueError( + "Missing the required parameter `node_id` when calling `delete_node`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if "node_id" in params: + query_params.append(("node_id", params["node_id"])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/node", + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def get_node(self, **kwargs): # noqa: E501 + """get an existing node # noqa: E501 + + ID of the node # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_node(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.get_node_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_node_with_http_info(**kwargs) # noqa: E501 + return data + + def get_node_with_http_info(self, **kwargs): # noqa: E501 + """get an existing node # noqa: E501 + + ID of the node # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_node_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_node" % key + ) + params[key] = val + del params["kwargs"] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/node", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def update_node(self, body, **kwargs): # noqa: E501 + """Update an existing node # noqa: E501 + + ID of node that needs to be updated. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_node(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Node body: node object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.update_node_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.update_node_with_http_info(body, **kwargs) # noqa: E501 + return data + + def update_node_with_http_info(self, body, **kwargs): # noqa: E501 + """Update an existing node # noqa: E501 + + ID of node that needs to be updated. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_node_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Node body: node object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_node" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `update_node`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/node", + "PUT", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/sdx_lc_client/api/topology_api.py b/sdx_lc_client/api/topology_api.py new file mode 100644 index 0000000..926e44d --- /dev/null +++ b/sdx_lc_client/api/topology_api.py @@ -0,0 +1,858 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from sdx_lc_client.api_client import ApiClient + + +class TopologyApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_topology(self, body, **kwargs): # noqa: E501 + """Send a new topology to SDX-LC # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_topology(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Topology body: placed for adding a new topology (required) + :return: Topology + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.add_topology_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.add_topology_with_http_info(body, **kwargs) # noqa: E501 + return data + + def add_topology_with_http_info(self, body, **kwargs): # noqa: E501 + """Send a new topology to SDX-LC # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_topology_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Topology body: placed for adding a new topology (required) + :return: Topology + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_topology" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `add_topology`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 + + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Topology", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def delete_topology(self, topology_id, **kwargs): # noqa: E501 + """Deletes a topology # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_topology(topology_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.delete_topology_with_http_info( + topology_id, **kwargs + ) # noqa: E501 + else: + (data) = self.delete_topology_with_http_info( + topology_id, **kwargs + ) # noqa: E501 + return data + + def delete_topology_with_http_info(self, topology_id, **kwargs): # noqa: E501 + """Deletes a topology # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_topology_with_http_info(topology_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["topology_id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_topology" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'topology_id' is set + if "topology_id" not in params or params["topology_id"] is None: + raise ValueError( + "Missing the required parameter `topology_id` when calling `delete_topology`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if "topology_id" in params: + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology", + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def delete_topology_version(self, topology_id, version, **kwargs): # noqa: E501 + """Deletes a topology version # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_topology_version(topology_id, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to return (required) + :param int version: topology version to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.delete_topology_version_with_http_info( + topology_id, version, **kwargs + ) # noqa: E501 + else: + (data) = self.delete_topology_version_with_http_info( + topology_id, version, **kwargs + ) # noqa: E501 + return data + + def delete_topology_version_with_http_info( + self, topology_id, version, **kwargs + ): # noqa: E501 + """Deletes a topology version # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_topology_version_with_http_info(topology_id, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to return (required) + :param int version: topology version to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["topology_id", "version"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_topology_version" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'topology_id' is set + if "topology_id" not in params or params["topology_id"] is None: + raise ValueError( + "Missing the required parameter `topology_id` when calling `delete_topology_version`" + ) # noqa: E501 + # verify the required parameter 'version' is set + if "version" not in params or params["version"] is None: + raise ValueError( + "Missing the required parameter `version` when calling `delete_topology_version`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "version" in params: + path_params["version"] = params["version"] # noqa: E501 + + query_params = [] + if "topology_id" in params: + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology/{version}", + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def get_topology(self, **kwargs): # noqa: E501 + """get an existing topology # noqa: E501 + + ID of the topology # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_topology(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.get_topology_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_topology_with_http_info(**kwargs) # noqa: E501 + return data + + def get_topology_with_http_info(self, **kwargs): # noqa: E501 + """get an existing topology # noqa: E501 + + ID of the topology # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_topology_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_topology" % key + ) + params[key] = val + del params["kwargs"] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["text/plain"] + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="str", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def get_topologyby_version(self, topology_id, version, **kwargs): # noqa: E501 + """Find topology by version # noqa: E501 + + Returns a single topology # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_topologyby_version(topology_id, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to return (required) + :param int version: version of topology to return (required) + :return: Topology + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.get_topologyby_version_with_http_info( + topology_id, version, **kwargs + ) # noqa: E501 + else: + (data) = self.get_topologyby_version_with_http_info( + topology_id, version, **kwargs + ) # noqa: E501 + return data + + def get_topologyby_version_with_http_info( + self, topology_id, version, **kwargs + ): # noqa: E501 + """Find topology by version # noqa: E501 + + Returns a single topology # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_topologyby_version_with_http_info(topology_id, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to return (required) + :param int version: version of topology to return (required) + :return: Topology + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["topology_id", "version"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_topologyby_version" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'topology_id' is set + if "topology_id" not in params or params["topology_id"] is None: + raise ValueError( + "Missing the required parameter `topology_id` when calling `get_topologyby_version`" + ) # noqa: E501 + # verify the required parameter 'version' is set + if "version" not in params or params["version"] is None: + raise ValueError( + "Missing the required parameter `version` when calling `get_topologyby_version`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "version" in params: + path_params["version"] = params["version"] # noqa: E501 + + query_params = [] + if "topology_id" in params: + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology/{version}", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Topology", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def topology_version(self, topology_id, **kwargs): # noqa: E501 + """Finds topology version # noqa: E501 + + Topology version # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.topology_version(topology_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str topology_id: topology id (required) + :return: Topology + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.topology_version_with_http_info( + topology_id, **kwargs + ) # noqa: E501 + else: + (data) = self.topology_version_with_http_info( + topology_id, **kwargs + ) # noqa: E501 + return data + + def topology_version_with_http_info(self, topology_id, **kwargs): # noqa: E501 + """Finds topology version # noqa: E501 + + Topology version # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.topology_version_with_http_info(topology_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str topology_id: topology id (required) + :return: Topology + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["topology_id"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method topology_version" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'topology_id' is set + if "topology_id" not in params or params["topology_id"] is None: + raise ValueError( + "Missing the required parameter `topology_id` when calling `topology_version`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if "topology_id" in params: + query_params.append(("topology_id", params["topology_id"])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology/version", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="Topology", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def update_topology(self, body, **kwargs): # noqa: E501 + """Update an existing topology # noqa: E501 + + ID of topology that needs to be updated. \\\\ The topology update only updates the addition or deletion \\\\ of node, port, link. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_topology(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Topology body: topology object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.update_topology_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.update_topology_with_http_info(body, **kwargs) # noqa: E501 + return data + + def update_topology_with_http_info(self, body, **kwargs): # noqa: E501 + """Update an existing topology # noqa: E501 + + ID of topology that needs to be updated. \\\\ The topology update only updates the addition or deletion \\\\ of node, port, link. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_topology_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Topology body: topology object that needs to be sent to the SDX LC (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_topology" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `update_topology`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology", + "PUT", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def upload_file(self, topology_id, **kwargs): # noqa: E501 + """uploads an topology image # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.upload_file(topology_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to update (required) + :param Object body: + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.upload_file_with_http_info(topology_id, **kwargs) # noqa: E501 + else: + (data) = self.upload_file_with_http_info( + topology_id, **kwargs + ) # noqa: E501 + return data + + def upload_file_with_http_info(self, topology_id, **kwargs): # noqa: E501 + """uploads an topology image # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.upload_file_with_http_info(topology_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int topology_id: ID of topology to update (required) + :param Object body: + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["topology_id", "body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'topology_id' is set + if "topology_id" not in params or params["topology_id"] is None: + raise ValueError( + "Missing the required parameter `topology_id` when calling `upload_file`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "topology_id" in params: + path_params["topology_id"] = params["topology_id"] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # noqa: E501 + + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/octet-stream"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/topology/{topology_id}/uploadImage", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="ApiResponse", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/sdx_lc_client/api/user_api.py b/sdx_lc_client/api/user_api.py new file mode 100644 index 0000000..63113a2 --- /dev/null +++ b/sdx_lc_client/api/user_api.py @@ -0,0 +1,844 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from sdx_lc_client.api_client import ApiClient + + +class UserApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_user(self, body, **kwargs): # noqa: E501 + """Create user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_user(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: Created user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.create_user_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.create_user_with_http_info(body, **kwargs) # noqa: E501 + return data + + def create_user_with_http_info(self, body, **kwargs): # noqa: E501 + """Create user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_user_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: Created user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_user" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `create_user`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def create_users_with_array_input(self, body, **kwargs): # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_users_with_array_input(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.create_users_with_array_input_with_http_info( + body, **kwargs + ) # noqa: E501 + else: + (data) = self.create_users_with_array_input_with_http_info( + body, **kwargs + ) # noqa: E501 + return data + + def create_users_with_array_input_with_http_info( + self, body, **kwargs + ): # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_users_with_array_input_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_users_with_array_input" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `create_users_with_array_input`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user/createWithArray", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def create_users_with_list_input(self, body, **kwargs): # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_users_with_list_input(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.create_users_with_list_input_with_http_info( + body, **kwargs + ) # noqa: E501 + else: + (data) = self.create_users_with_list_input_with_http_info( + body, **kwargs + ) # noqa: E501 + return data + + def create_users_with_list_input_with_http_info(self, body, **kwargs): # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_users_with_list_input_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_users_with_list_input" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `create_users_with_list_input`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user/createWithList", + "POST", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def delete_user(self, username, **kwargs): # noqa: E501 + """Delete user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user(username, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + return data + + def delete_user_with_http_info(self, username, **kwargs): # noqa: E501 + """Delete user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_with_http_info(username, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["username"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'username' is set + if "username" not in params or params["username"] is None: + raise ValueError( + "Missing the required parameter `username` when calling `delete_user`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "username" in params: + path_params["username"] = params["username"] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user/{username}", + "DELETE", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def get_user_by_name(self, username, **kwargs): # noqa: E501 + """Get user by user name # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_name(username, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.get_user_by_name_with_http_info( + username, **kwargs + ) # noqa: E501 + else: + (data) = self.get_user_by_name_with_http_info( + username, **kwargs + ) # noqa: E501 + return data + + def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 + """Get user by user name # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_name_with_http_info(username, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["username"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_name" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'username' is set + if "username" not in params or params["username"] is None: + raise ValueError( + "Missing the required parameter `username` when calling `get_user_by_name`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "username" in params: + path_params["username"] = params["username"] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json", "application/xml"] + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user/{username}", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="User", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def login_user(self, username, password, **kwargs): # noqa: E501 + """Logs user into the system # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_user(username, password, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str username: The user name for login (required) + :param str password: The password for login in clear text (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.login_user_with_http_info( + username, password, **kwargs + ) # noqa: E501 + else: + (data) = self.login_user_with_http_info( + username, password, **kwargs + ) # noqa: E501 + return data + + def login_user_with_http_info(self, username, password, **kwargs): # noqa: E501 + """Logs user into the system # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_user_with_http_info(username, password, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str username: The user name for login (required) + :param str password: The password for login in clear text (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["username", "password"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method login_user" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'username' is set + if "username" not in params or params["username"] is None: + raise ValueError( + "Missing the required parameter `username` when calling `login_user`" + ) # noqa: E501 + # verify the required parameter 'password' is set + if "password" not in params or params["password"] is None: + raise ValueError( + "Missing the required parameter `password` when calling `login_user`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if "username" in params: + query_params.append(("username", params["username"])) # noqa: E501 + if "password" in params: + query_params.append(("password", params["password"])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params["Accept"] = self.api_client.select_header_accept( + ["application/json", "application/xml"] + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user/login", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type="str", # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def logout_user(self, **kwargs): # noqa: E501 + """Logs out current logged in user session # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_user(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.logout_user_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.logout_user_with_http_info(**kwargs) # noqa: E501 + return data + + def logout_user_with_http_info(self, **kwargs): # noqa: E501 + """Logs out current logged in user session # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_user_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_user" % key + ) + params[key] = val + del params["kwargs"] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user/logout", + "GET", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) + + def update_user(self, body, username, **kwargs): # noqa: E501 + """Updated user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_user(body, username, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: Updated user object (required) + :param str username: name that need to be updated (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs["_return_http_data_only"] = True + if kwargs.get("async_req"): + return self.update_user_with_http_info( + body, username, **kwargs + ) # noqa: E501 + else: + (data) = self.update_user_with_http_info( + body, username, **kwargs + ) # noqa: E501 + return data + + def update_user_with_http_info(self, body, username, **kwargs): # noqa: E501 + """Updated user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_user_with_http_info(body, username, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: Updated user object (required) + :param str username: name that need to be updated (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ["body", "username"] # noqa: E501 + all_params.append("async_req") + all_params.append("_return_http_data_only") + all_params.append("_preload_content") + all_params.append("_request_timeout") + + params = locals() + for key, val in six.iteritems(params["kwargs"]): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_user" % key + ) + params[key] = val + del params["kwargs"] + # verify the required parameter 'body' is set + if "body" not in params or params["body"] is None: + raise ValueError( + "Missing the required parameter `body` when calling `update_user`" + ) # noqa: E501 + # verify the required parameter 'username' is set + if "username" not in params or params["username"] is None: + raise ValueError( + "Missing the required parameter `username` when calling `update_user`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if "username" in params: + path_params["username"] = params["username"] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if "body" in params: + body_params = params["body"] + # HTTP header `Content-Type` + header_params["Content-Type"] = ( + self.api_client.select_header_content_type( # noqa: E501 + ["application/json"] + ) + ) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + "/user/{username}", + "PUT", + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get("async_req"), + _return_http_data_only=params.get("_return_http_data_only"), + _preload_content=params.get("_preload_content", True), + _request_timeout=params.get("_request_timeout"), + collection_formats=collection_formats, + ) diff --git a/sdx_lc_client/api_client.py b/sdx_lc_client/api_client.py new file mode 100644 index 0000000..791b245 --- /dev/null +++ b/sdx_lc_client/api_client.py @@ -0,0 +1,709 @@ +# coding: utf-8 +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" +from __future__ import absolute_import + +import datetime +import json +import mimetypes +import os +import re +import tempfile +from multiprocessing.pool import ThreadPool + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +import sdx_lc_client.models +from sdx_lc_client import rest +from sdx_lc_client.configuration import Configuration + + +class ApiClient(object): + """Generic API client for Swagger client library builds. + + Swagger generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the Swagger + templates. + + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + "int": int, + "long": int if six.PY3 else long, # noqa: F821 + "float": float, + "str": str, + "bool": bool, + "date": datetime.date, + "datetime": datetime.datetime, + "object": object, + } + + def __init__( + self, configuration=None, header_name=None, header_value=None, cookie=None + ): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + self.pool = ThreadPool() + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = "Swagger-Codegen/2.0.0/python" + + def __del__(self): + self.pool.close() + self.pool.join() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers["User-Agent"] + + @user_agent.setter + def user_agent(self, value): + self.default_headers["User-Agent"] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + ): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params["Cookie"] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params, collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = self.request( + method, + url, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + ) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return return_data + else: + return (return_data, response_data.status, response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = { + obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None + } + + return { + key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict) + } + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith("list["): + sub_kls = re.match(r"list\[(.*)\]", klass).group(1) + return [self.__deserialize(sub_data, sub_kls) for sub_data in data] + + if klass.startswith("dict("): + sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2) + return { + k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data) + } + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(sdx_lc_client.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api( + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + async_req=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + ): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + if not async_req: + return self.__call_api( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + ) + else: + thread = self.pool.apply_async( + self.__call_api, + ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + ), + ) + return thread + + def request( + self, + method, + url, + query_params=None, + headers=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.GET( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) + elif method == "HEAD": + return self.rest_client.HEAD( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) + elif method == "OPTIONS": + return self.rest_client.OPTIONS( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + elif method == "POST": + return self.rest_client.POST( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + elif method == "PUT": + return self.rest_client.PUT( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + elif method == "PATCH": + return self.rest_client.PATCH( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + elif method == "DELETE": + return self.rest_client.DELETE( + url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + else: + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in ( + six.iteritems(params) if isinstance(params, dict) else params + ): # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == "multi": + new_params.extend((k, value) for value in v) + else: + if collection_format == "ssv": + delimiter = " " + elif collection_format == "tsv": + delimiter = "\t" + elif collection_format == "pipes": + delimiter = "|" + else: # csv is the default + delimiter = "," + new_params.append((k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """Builds form parameters. + + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, "rb") as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = ( + mimetypes.guess_type(filename)[0] + or "application/octet-stream" + ) + params.append(tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if "application/json" in accepts: + return "application/json" + else: + return ", ".join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return "application/json" + + content_types = [x.lower() for x in content_types] + + if "application/json" in content_types or "*/*" in content_types: + return "application/json" + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting["value"]: + continue + elif auth_setting["in"] == "header": + headers[auth_setting["key"]] = auth_setting["value"] + elif auth_setting["in"] == "query": + querys.append((auth_setting["key"], auth_setting["value"])) + else: + raise ValueError( + "Authentication token must be in `query` or `header`" + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition + ).group(1) + path = os.path.join(os.path.dirname(path), filename) + response_data = response.data + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode("utf-8") + f.write(response_data) + else: + f.write(response_data) + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=("Failed to parse `{0}` as datetime object".format(string)), + ) + + def __hasattr(self, object, name): + return name in object.__class__.__dict__ + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.swagger_types and not self.__hasattr( + klass, "get_real_child_model" + ): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in six.iteritems(klass.swagger_types): + if ( + data is not None + and klass.attribute_map[attr] in data + and isinstance(data, (list, dict)) + ): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if ( + isinstance(instance, dict) + and klass.swagger_types is not None + and isinstance(data, dict) + ): + for key, value in data.items(): + if key not in klass.swagger_types: + instance[key] = value + if self.__hasattr(instance, "get_real_child_model"): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/sdx_lc_client/configuration.py b/sdx_lc_client/configuration.py new file mode 100644 index 0000000..107535b --- /dev/null +++ b/sdx_lc_client/configuration.py @@ -0,0 +1,247 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys + +import six +import urllib3 +from six.moves import http_client as httplib + + +class TypeWithDefault(type): + def __init__(cls, name, bases, dct): + super(TypeWithDefault, cls).__init__(name, bases, dct) + cls._default = None + + def __call__(cls): + if cls._default is None: + cls._default = type.__call__(cls) + return copy.copy(cls._default) + + def set_default(cls, default): + cls._default = copy.copy(default) + + +class Configuration(six.with_metaclass(TypeWithDefault, object)): + """NOTE: This class is auto generated by the swagger code generator program. + + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + """ + + def __init__(self): + """Constructor""" + # Default Base url + self.host = "https://virtserver.swaggerhub.com/SDX-LC/2.0.0" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # function to refresh API key if expired + self.refresh_api_key_hook = None + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("sdx_lc_client") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = "%(asctime)s %(levelname)s %(message)s" + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API + # from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = "" + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook: + self.refresh_api_key_hook(self) + + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + token = "" + if self.username or self.password: + token = urllib3.util.make_headers( + basic_auth=self.username + ":" + self.password + ).get("authorization") + return token + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return {} + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return ( + "Python SDK Debug Report:\n" + "OS: {env}\n" + "Python Version: {pyversion}\n" + "Version of the API: 2.0.0\n" + "SDK Package Version: 2.0.0".format(env=sys.platform, pyversion=sys.version) + ) diff --git a/sdx_lc_client/models/__init__.py b/sdx_lc_client/models/__init__.py new file mode 100644 index 0000000..4c6a40b --- /dev/null +++ b/sdx_lc_client/models/__init__.py @@ -0,0 +1,26 @@ +# coding: utf-8 + +# flake8: noqa +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +# import models into model package +from sdx_lc_client.models.api_response import ApiResponse +from sdx_lc_client.models.connection import Connection +from sdx_lc_client.models.link import Link +from sdx_lc_client.models.link_measurement_period import LinkMeasurementPeriod +from sdx_lc_client.models.location import Location +from sdx_lc_client.models.node import Node +from sdx_lc_client.models.port import Port +from sdx_lc_client.models.service import Service +from sdx_lc_client.models.topology import Topology +from sdx_lc_client.models.user import User diff --git a/sdx_lc_client/models/api_response.py b/sdx_lc_client/models/api_response.py new file mode 100644 index 0000000..4383d17 --- /dev/null +++ b/sdx_lc_client/models/api_response.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class ApiResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = {"code": "int", "type": "str", "message": "str"} + + attribute_map = {"code": "code", "type": "type", "message": "message"} + + def __init__(self, code=None, type=None, message=None): # noqa: E501 + """ApiResponse - a model defined in Swagger""" # noqa: E501 + self._code = None + self._type = None + self._message = None + self.discriminator = None + if code is not None: + self.code = code + if type is not None: + self.type = type + if message is not None: + self.message = message + + @property + def code(self): + """Gets the code of this ApiResponse. # noqa: E501 + + + :return: The code of this ApiResponse. # noqa: E501 + :rtype: int + """ + return self._code + + @code.setter + def code(self, code): + """Sets the code of this ApiResponse. + + + :param code: The code of this ApiResponse. # noqa: E501 + :type: int + """ + + self._code = code + + @property + def type(self): + """Gets the type of this ApiResponse. # noqa: E501 + + + :return: The type of this ApiResponse. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ApiResponse. + + + :param type: The type of this ApiResponse. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def message(self): + """Gets the message of this ApiResponse. # noqa: E501 + + + :return: The message of this ApiResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ApiResponse. + + + :param message: The message of this ApiResponse. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(ApiResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/connection.py b/sdx_lc_client/models/connection.py new file mode 100644 index 0000000..bb4c292 --- /dev/null +++ b/sdx_lc_client/models/connection.py @@ -0,0 +1,739 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class Connection(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "id": "str", + "name": "str", + "ingress_port": "Port", + "egress_port": "Port", + "quantity": "int", + "start_time": "datetime", + "end_time": "datetime", + "multi_path": "bool", + "preempt": "bool", + "backup_path_type": "str", + "exclusive_links": "list[Link]", + "inclusive_links": "list[Link]", + "bandwidth_required": "float", + "bandwidth_measured": "float", + "latency_required": "float", + "latency_measured": "float", + "packetloss_required": "float", + "packetloss_measured": "float", + "availability_required": "float", + "availability_measured": "float", + "paths": "list[str]", + "status": "str", + "complete": "bool", + } + + attribute_map = { + "id": "id", + "name": "name", + "ingress_port": "ingress_port", + "egress_port": "egress_port", + "quantity": "quantity", + "start_time": "start_time", + "end_time": "end_time", + "multi_path": "multi_path", + "preempt": "preempt", + "backup_path_type": "backup_path_type", + "exclusive_links": "exclusive_links", + "inclusive_links": "inclusive_links", + "bandwidth_required": "bandwidth_required", + "bandwidth_measured": "bandwidth_measured", + "latency_required": "latency_required", + "latency_measured": "latency_measured", + "packetloss_required": "packetloss_required", + "packetloss_measured": "packetloss_measured", + "availability_required": "availability_required", + "availability_measured": "availability_measured", + "paths": "paths", + "status": "status", + "complete": "complete", + } + + def __init__( + self, + id=None, + name=None, + ingress_port=None, + egress_port=None, + quantity=None, + start_time=None, + end_time=None, + multi_path=None, + preempt=None, + backup_path_type=None, + exclusive_links=None, + inclusive_links=None, + bandwidth_required=None, + bandwidth_measured=None, + latency_required=None, + latency_measured=None, + packetloss_required=None, + packetloss_measured=None, + availability_required=None, + availability_measured=None, + paths=None, + status=None, + complete=False, + ): # noqa: E501 + """Connection - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._ingress_port = None + self._egress_port = None + self._quantity = None + self._start_time = None + self._end_time = None + self._multi_path = None + self._preempt = None + self._backup_path_type = None + self._exclusive_links = None + self._inclusive_links = None + self._bandwidth_required = None + self._bandwidth_measured = None + self._latency_required = None + self._latency_measured = None + self._packetloss_required = None + self._packetloss_measured = None + self._availability_required = None + self._availability_measured = None + self._paths = None + self._status = None + self._complete = None + self.discriminator = None + self.id = id + self.name = name + self.ingress_port = ingress_port + self.egress_port = egress_port + if quantity is not None: + self.quantity = quantity + if start_time is not None: + self.start_time = start_time + if end_time is not None: + self.end_time = end_time + if multi_path is not None: + self.multi_path = multi_path + if preempt is not None: + self.preempt = preempt + if backup_path_type is not None: + self.backup_path_type = backup_path_type + if exclusive_links is not None: + self.exclusive_links = exclusive_links + if inclusive_links is not None: + self.inclusive_links = inclusive_links + if bandwidth_required is not None: + self.bandwidth_required = bandwidth_required + if bandwidth_measured is not None: + self.bandwidth_measured = bandwidth_measured + if latency_required is not None: + self.latency_required = latency_required + if latency_measured is not None: + self.latency_measured = latency_measured + if packetloss_required is not None: + self.packetloss_required = packetloss_required + if packetloss_measured is not None: + self.packetloss_measured = packetloss_measured + if availability_required is not None: + self.availability_required = availability_required + if availability_measured is not None: + self.availability_measured = availability_measured + if paths is not None: + self.paths = paths + if status is not None: + self.status = status + if complete is not None: + self.complete = complete + + @property + def id(self): + """Gets the id of this Connection. # noqa: E501 + + + :return: The id of this Connection. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Connection. + + + :param id: The id of this Connection. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this Connection. # noqa: E501 + + + :return: The name of this Connection. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Connection. + + + :param name: The name of this Connection. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 + + self._name = name + + @property + def ingress_port(self): + """Gets the ingress_port of this Connection. # noqa: E501 + + + :return: The ingress_port of this Connection. # noqa: E501 + :rtype: Port + """ + return self._ingress_port + + @ingress_port.setter + def ingress_port(self, ingress_port): + """Sets the ingress_port of this Connection. + + + :param ingress_port: The ingress_port of this Connection. # noqa: E501 + :type: Port + """ + if ingress_port is None: + raise ValueError( + "Invalid value for `ingress_port`, must not be `None`" + ) # noqa: E501 + + self._ingress_port = ingress_port + + @property + def egress_port(self): + """Gets the egress_port of this Connection. # noqa: E501 + + + :return: The egress_port of this Connection. # noqa: E501 + :rtype: Port + """ + return self._egress_port + + @egress_port.setter + def egress_port(self, egress_port): + """Sets the egress_port of this Connection. + + + :param egress_port: The egress_port of this Connection. # noqa: E501 + :type: Port + """ + if egress_port is None: + raise ValueError( + "Invalid value for `egress_port`, must not be `None`" + ) # noqa: E501 + + self._egress_port = egress_port + + @property + def quantity(self): + """Gets the quantity of this Connection. # noqa: E501 + + + :return: The quantity of this Connection. # noqa: E501 + :rtype: int + """ + return self._quantity + + @quantity.setter + def quantity(self, quantity): + """Sets the quantity of this Connection. + + + :param quantity: The quantity of this Connection. # noqa: E501 + :type: int + """ + + self._quantity = quantity + + @property + def start_time(self): + """Gets the start_time of this Connection. # noqa: E501 + + + :return: The start_time of this Connection. # noqa: E501 + :rtype: datetime + """ + return self._start_time + + @start_time.setter + def start_time(self, start_time): + """Sets the start_time of this Connection. + + + :param start_time: The start_time of this Connection. # noqa: E501 + :type: datetime + """ + + self._start_time = start_time + + @property + def end_time(self): + """Gets the end_time of this Connection. # noqa: E501 + + + :return: The end_time of this Connection. # noqa: E501 + :rtype: datetime + """ + return self._end_time + + @end_time.setter + def end_time(self, end_time): + """Sets the end_time of this Connection. + + + :param end_time: The end_time of this Connection. # noqa: E501 + :type: datetime + """ + + self._end_time = end_time + + @property + def multi_path(self): + """Gets the multi_path of this Connection. # noqa: E501 + + + :return: The multi_path of this Connection. # noqa: E501 + :rtype: bool + """ + return self._multi_path + + @multi_path.setter + def multi_path(self, multi_path): + """Sets the multi_path of this Connection. + + + :param multi_path: The multi_path of this Connection. # noqa: E501 + :type: bool + """ + + self._multi_path = multi_path + + @property + def preempt(self): + """Gets the preempt of this Connection. # noqa: E501 + + + :return: The preempt of this Connection. # noqa: E501 + :rtype: bool + """ + return self._preempt + + @preempt.setter + def preempt(self, preempt): + """Sets the preempt of this Connection. + + + :param preempt: The preempt of this Connection. # noqa: E501 + :type: bool + """ + + self._preempt = preempt + + @property + def backup_path_type(self): + """Gets the backup_path_type of this Connection. # noqa: E501 + + + :return: The backup_path_type of this Connection. # noqa: E501 + :rtype: str + """ + return self._backup_path_type + + @backup_path_type.setter + def backup_path_type(self, backup_path_type): + """Sets the backup_path_type of this Connection. + + + :param backup_path_type: The backup_path_type of this Connection. # noqa: E501 + :type: str + """ + allowed_values = ["0", "1", "2", "3"] # noqa: E501 + if backup_path_type not in allowed_values: + raise ValueError( + "Invalid value for `backup_path_type` ({0}), must be one of {1}".format( # noqa: E501 + backup_path_type, allowed_values + ) + ) + + self._backup_path_type = backup_path_type + + @property + def exclusive_links(self): + """Gets the exclusive_links of this Connection. # noqa: E501 + + + :return: The exclusive_links of this Connection. # noqa: E501 + :rtype: list[Link] + """ + return self._exclusive_links + + @exclusive_links.setter + def exclusive_links(self, exclusive_links): + """Sets the exclusive_links of this Connection. + + + :param exclusive_links: The exclusive_links of this Connection. # noqa: E501 + :type: list[Link] + """ + + self._exclusive_links = exclusive_links + + @property + def inclusive_links(self): + """Gets the inclusive_links of this Connection. # noqa: E501 + + + :return: The inclusive_links of this Connection. # noqa: E501 + :rtype: list[Link] + """ + return self._inclusive_links + + @inclusive_links.setter + def inclusive_links(self, inclusive_links): + """Sets the inclusive_links of this Connection. + + + :param inclusive_links: The inclusive_links of this Connection. # noqa: E501 + :type: list[Link] + """ + + self._inclusive_links = inclusive_links + + @property + def bandwidth_required(self): + """Gets the bandwidth_required of this Connection. # noqa: E501 + + + :return: The bandwidth_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._bandwidth_required + + @bandwidth_required.setter + def bandwidth_required(self, bandwidth_required): + """Sets the bandwidth_required of this Connection. + + + :param bandwidth_required: The bandwidth_required of this Connection. # noqa: E501 + :type: float + """ + + self._bandwidth_required = bandwidth_required + + @property + def bandwidth_measured(self): + """Gets the bandwidth_measured of this Connection. # noqa: E501 + + + :return: The bandwidth_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._bandwidth_measured + + @bandwidth_measured.setter + def bandwidth_measured(self, bandwidth_measured): + """Sets the bandwidth_measured of this Connection. + + + :param bandwidth_measured: The bandwidth_measured of this Connection. # noqa: E501 + :type: float + """ + + self._bandwidth_measured = bandwidth_measured + + @property + def latency_required(self): + """Gets the latency_required of this Connection. # noqa: E501 + + + :return: The latency_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._latency_required + + @latency_required.setter + def latency_required(self, latency_required): + """Sets the latency_required of this Connection. + + + :param latency_required: The latency_required of this Connection. # noqa: E501 + :type: float + """ + + self._latency_required = latency_required + + @property + def latency_measured(self): + """Gets the latency_measured of this Connection. # noqa: E501 + + + :return: The latency_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._latency_measured + + @latency_measured.setter + def latency_measured(self, latency_measured): + """Sets the latency_measured of this Connection. + + + :param latency_measured: The latency_measured of this Connection. # noqa: E501 + :type: float + """ + + self._latency_measured = latency_measured + + @property + def packetloss_required(self): + """Gets the packetloss_required of this Connection. # noqa: E501 + + + :return: The packetloss_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._packetloss_required + + @packetloss_required.setter + def packetloss_required(self, packetloss_required): + """Sets the packetloss_required of this Connection. + + + :param packetloss_required: The packetloss_required of this Connection. # noqa: E501 + :type: float + """ + + self._packetloss_required = packetloss_required + + @property + def packetloss_measured(self): + """Gets the packetloss_measured of this Connection. # noqa: E501 + + + :return: The packetloss_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._packetloss_measured + + @packetloss_measured.setter + def packetloss_measured(self, packetloss_measured): + """Sets the packetloss_measured of this Connection. + + + :param packetloss_measured: The packetloss_measured of this Connection. # noqa: E501 + :type: float + """ + + self._packetloss_measured = packetloss_measured + + @property + def availability_required(self): + """Gets the availability_required of this Connection. # noqa: E501 + + + :return: The availability_required of this Connection. # noqa: E501 + :rtype: float + """ + return self._availability_required + + @availability_required.setter + def availability_required(self, availability_required): + """Sets the availability_required of this Connection. + + + :param availability_required: The availability_required of this Connection. # noqa: E501 + :type: float + """ + + self._availability_required = availability_required + + @property + def availability_measured(self): + """Gets the availability_measured of this Connection. # noqa: E501 + + + :return: The availability_measured of this Connection. # noqa: E501 + :rtype: float + """ + return self._availability_measured + + @availability_measured.setter + def availability_measured(self, availability_measured): + """Sets the availability_measured of this Connection. + + + :param availability_measured: The availability_measured of this Connection. # noqa: E501 + :type: float + """ + + self._availability_measured = availability_measured + + @property + def paths(self): + """Gets the paths of this Connection. # noqa: E501 + + + :return: The paths of this Connection. # noqa: E501 + :rtype: list[str] + """ + return self._paths + + @paths.setter + def paths(self, paths): + """Sets the paths of this Connection. + + + :param paths: The paths of this Connection. # noqa: E501 + :type: list[str] + """ + + self._paths = paths + + @property + def status(self): + """Gets the status of this Connection. # noqa: E501 + + Connection Status # noqa: E501 + + :return: The status of this Connection. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Connection. + + Connection Status # noqa: E501 + + :param status: The status of this Connection. # noqa: E501 + :type: str + """ + allowed_values = ["success", "fail", "scheduled", "provisioining"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}".format( # noqa: E501 + status, allowed_values + ) + ) + + self._status = status + + @property + def complete(self): + """Gets the complete of this Connection. # noqa: E501 + + + :return: The complete of this Connection. # noqa: E501 + :rtype: bool + """ + return self._complete + + @complete.setter + def complete(self, complete): + """Sets the complete of this Connection. + + + :param complete: The complete of this Connection. # noqa: E501 + :type: bool + """ + + self._complete = complete + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(Connection, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Connection): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/link.py b/sdx_lc_client/models/link.py new file mode 100644 index 0000000..d8b1166 --- /dev/null +++ b/sdx_lc_client/models/link.py @@ -0,0 +1,477 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class Link(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "id": "str", + "name": "str", + "short_name": "str", + "ports": "list[Port]", + "bandwidth": "float", + "residual_bandwidth": "float", + "latency": "float", + "packet_loss": "float", + "availability": "float", + "status": "str", + "state": "str", + "private_attributes": "list[str]", + "timestamp": "datetime", + "measurement_period": "LinkMeasurementPeriod", + } + + attribute_map = { + "id": "id", + "name": "name", + "short_name": "short_name", + "ports": "ports", + "bandwidth": "bandwidth", + "residual_bandwidth": "residual_bandwidth", + "latency": "latency", + "packet_loss": "packet_loss", + "availability": "availability", + "status": "status", + "state": "state", + "private_attributes": "private_attributes", + "timestamp": "timestamp", + "measurement_period": "measurement_period", + } + + def __init__( + self, + id=None, + name=None, + short_name=None, + ports=None, + bandwidth=None, + residual_bandwidth=None, + latency=None, + packet_loss=None, + availability=None, + status=None, + state=None, + private_attributes=None, + timestamp=None, + measurement_period=None, + ): # noqa: E501 + """Link - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._short_name = None + self._ports = None + self._bandwidth = None + self._residual_bandwidth = None + self._latency = None + self._packet_loss = None + self._availability = None + self._status = None + self._state = None + self._private_attributes = None + self._timestamp = None + self._measurement_period = None + self.discriminator = None + self.id = id + self.name = name + if short_name is not None: + self.short_name = short_name + self.ports = ports + if bandwidth is not None: + self.bandwidth = bandwidth + if residual_bandwidth is not None: + self.residual_bandwidth = residual_bandwidth + if latency is not None: + self.latency = latency + if packet_loss is not None: + self.packet_loss = packet_loss + if availability is not None: + self.availability = availability + if status is not None: + self.status = status + if state is not None: + self.state = state + if private_attributes is not None: + self.private_attributes = private_attributes + if timestamp is not None: + self.timestamp = timestamp + if measurement_period is not None: + self.measurement_period = measurement_period + + @property + def id(self): + """Gets the id of this Link. # noqa: E501 + + + :return: The id of this Link. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Link. + + + :param id: The id of this Link. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this Link. # noqa: E501 + + + :return: The name of this Link. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Link. + + + :param name: The name of this Link. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 + + self._name = name + + @property + def short_name(self): + """Gets the short_name of this Link. # noqa: E501 + + + :return: The short_name of this Link. # noqa: E501 + :rtype: str + """ + return self._short_name + + @short_name.setter + def short_name(self, short_name): + """Sets the short_name of this Link. + + + :param short_name: The short_name of this Link. # noqa: E501 + :type: str + """ + + self._short_name = short_name + + @property + def ports(self): + """Gets the ports of this Link. # noqa: E501 + + + :return: The ports of this Link. # noqa: E501 + :rtype: list[Port] + """ + return self._ports + + @ports.setter + def ports(self, ports): + """Sets the ports of this Link. + + + :param ports: The ports of this Link. # noqa: E501 + :type: list[Port] + """ + if ports is None: + raise ValueError( + "Invalid value for `ports`, must not be `None`" + ) # noqa: E501 + + self._ports = ports + + @property + def bandwidth(self): + """Gets the bandwidth of this Link. # noqa: E501 + + + :return: The bandwidth of this Link. # noqa: E501 + :rtype: float + """ + return self._bandwidth + + @bandwidth.setter + def bandwidth(self, bandwidth): + """Sets the bandwidth of this Link. + + + :param bandwidth: The bandwidth of this Link. # noqa: E501 + :type: float + """ + + self._bandwidth = bandwidth + + @property + def residual_bandwidth(self): + """Gets the residual_bandwidth of this Link. # noqa: E501 + + + :return: The residual_bandwidth of this Link. # noqa: E501 + :rtype: float + """ + return self._residual_bandwidth + + @residual_bandwidth.setter + def residual_bandwidth(self, residual_bandwidth): + """Sets the residual_bandwidth of this Link. + + + :param residual_bandwidth: The residual_bandwidth of this Link. # noqa: E501 + :type: float + """ + + self._residual_bandwidth = residual_bandwidth + + @property + def latency(self): + """Gets the latency of this Link. # noqa: E501 + + + :return: The latency of this Link. # noqa: E501 + :rtype: float + """ + return self._latency + + @latency.setter + def latency(self, latency): + """Sets the latency of this Link. + + + :param latency: The latency of this Link. # noqa: E501 + :type: float + """ + + self._latency = latency + + @property + def packet_loss(self): + """Gets the packet_loss of this Link. # noqa: E501 + + + :return: The packet_loss of this Link. # noqa: E501 + :rtype: float + """ + return self._packet_loss + + @packet_loss.setter + def packet_loss(self, packet_loss): + """Sets the packet_loss of this Link. + + + :param packet_loss: The packet_loss of this Link. # noqa: E501 + :type: float + """ + + self._packet_loss = packet_loss + + @property + def availability(self): + """Gets the availability of this Link. # noqa: E501 + + + :return: The availability of this Link. # noqa: E501 + :rtype: float + """ + return self._availability + + @availability.setter + def availability(self, availability): + """Sets the availability of this Link. + + + :param availability: The availability of this Link. # noqa: E501 + :type: float + """ + + self._availability = availability + + @property + def status(self): + """Gets the status of this Link. # noqa: E501 + + + :return: The status of this Link. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Link. + + + :param status: The status of this Link. # noqa: E501 + :type: str + """ + + self._status = status + + @property + def state(self): + """Gets the state of this Link. # noqa: E501 + + + :return: The state of this Link. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Link. + + + :param state: The state of this Link. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def private_attributes(self): + """Gets the private_attributes of this Link. # noqa: E501 + + + :return: The private_attributes of this Link. # noqa: E501 + :rtype: list[str] + """ + return self._private_attributes + + @private_attributes.setter + def private_attributes(self, private_attributes): + """Sets the private_attributes of this Link. + + + :param private_attributes: The private_attributes of this Link. # noqa: E501 + :type: list[str] + """ + + self._private_attributes = private_attributes + + @property + def timestamp(self): + """Gets the timestamp of this Link. # noqa: E501 + + + :return: The timestamp of this Link. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this Link. + + + :param timestamp: The timestamp of this Link. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + @property + def measurement_period(self): + """Gets the measurement_period of this Link. # noqa: E501 + + + :return: The measurement_period of this Link. # noqa: E501 + :rtype: LinkMeasurementPeriod + """ + return self._measurement_period + + @measurement_period.setter + def measurement_period(self, measurement_period): + """Sets the measurement_period of this Link. + + + :param measurement_period: The measurement_period of this Link. # noqa: E501 + :type: LinkMeasurementPeriod + """ + + self._measurement_period = measurement_period + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(Link, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Link): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/link_measurement_period.py b/sdx_lc_client/models/link_measurement_period.py new file mode 100644 index 0000000..bf5cef4 --- /dev/null +++ b/sdx_lc_client/models/link_measurement_period.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class LinkMeasurementPeriod(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = {"period": "float", "time_unit": "str"} + + attribute_map = {"period": "period", "time_unit": "time_unit"} + + def __init__(self, period=None, time_unit=None): # noqa: E501 + """LinkMeasurementPeriod - a model defined in Swagger""" # noqa: E501 + self._period = None + self._time_unit = None + self.discriminator = None + if period is not None: + self.period = period + if time_unit is not None: + self.time_unit = time_unit + + @property + def period(self): + """Gets the period of this LinkMeasurementPeriod. # noqa: E501 + + + :return: The period of this LinkMeasurementPeriod. # noqa: E501 + :rtype: float + """ + return self._period + + @period.setter + def period(self, period): + """Sets the period of this LinkMeasurementPeriod. + + + :param period: The period of this LinkMeasurementPeriod. # noqa: E501 + :type: float + """ + + self._period = period + + @property + def time_unit(self): + """Gets the time_unit of this LinkMeasurementPeriod. # noqa: E501 + + + :return: The time_unit of this LinkMeasurementPeriod. # noqa: E501 + :rtype: str + """ + return self._time_unit + + @time_unit.setter + def time_unit(self, time_unit): + """Sets the time_unit of this LinkMeasurementPeriod. + + + :param time_unit: The time_unit of this LinkMeasurementPeriod. # noqa: E501 + :type: str + """ + + self._time_unit = time_unit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(LinkMeasurementPeriod, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LinkMeasurementPeriod): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/location.py b/sdx_lc_client/models/location.py new file mode 100644 index 0000000..f4f34af --- /dev/null +++ b/sdx_lc_client/models/location.py @@ -0,0 +1,196 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class Location(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "address": "str", + "latitude": "float", + "longitude": "float", + "iso3166_2_lvl4": "str", + } + + attribute_map = { + "address": "address", + "latitude": "latitude", + "longitude": "longitude", + "iso3166_2_lvl4": "iso3166_2_lvl4", + } + + def __init__( + self, address=None, latitude=None, longitude=None, iso3166_2_lvl4=None + ): # noqa: E501 + """Location - a model defined in Swagger""" # noqa: E501 + self._address = None + self._latitude = None + self._longitude = None + self._iso3166_2_lvl4 = None + self.discriminator = None + if address is not None: + self.address = address + if latitude is not None: + self.latitude = latitude + if longitude is not None: + self.longitude = longitude + if iso3166_2_lvl4 is not None: + self.iso3166_2_lvl4 = iso3166_2_lvl4 + + @property + def address(self): + """Gets the address of this Location. # noqa: E501 + + + :return: The address of this Location. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this Location. + + + :param address: The address of this Location. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def latitude(self): + """Gets the latitude of this Location. # noqa: E501 + + + :return: The latitude of this Location. # noqa: E501 + :rtype: float + """ + return self._latitude + + @latitude.setter + def latitude(self, latitude): + """Sets the latitude of this Location. + + + :param latitude: The latitude of this Location. # noqa: E501 + :type: float + """ + + self._latitude = latitude + + @property + def longitude(self): + """Gets the longitude of this Location. # noqa: E501 + + + :return: The longitude of this Location. # noqa: E501 + :rtype: float + """ + return self._longitude + + @longitude.setter + def longitude(self, longitude): + """Sets the longitude of this Location. + + + :param longitude: The longitude of this Location. # noqa: E501 + :type: float + """ + + self._longitude = longitude + + @property + def iso3166_2_lvl4(self): + """Gets the iso3166_2_lvl4 of this Location. # noqa: E501 + + + :return: The iso3166_2_lvl4 of this Location. # noqa: E501 + :rtype: str + """ + return self._iso3166_2_lvl4 + + @iso3166_2_lvl4.setter + def iso3166_2_lvl4(self, iso3166_2_lvl4): + """Sets the iso3166_2_lvl4 of this Location. + + + :param iso3166_2_lvl4: The iso3166_2_lvl4 of this Location. # noqa: E501 + :type: str + """ + + self._iso3166_2_lvl4 = iso3166_2_lvl4 + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(Location, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Location): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/node.py b/sdx_lc_client/models/node.py new file mode 100644 index 0000000..a4ae60a --- /dev/null +++ b/sdx_lc_client/models/node.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class Node(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "id": "str", + "name": "str", + "short_name": "str", + "location": "Location", + "ports": "list[Port]", + "private_attributes": "list[str]", + } + + attribute_map = { + "id": "id", + "name": "name", + "short_name": "short_name", + "location": "location", + "ports": "ports", + "private_attributes": "private_attributes", + } + + def __init__( + self, + id=None, + name=None, + short_name=None, + location=None, + ports=None, + private_attributes=None, + ): # noqa: E501 + """Node - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._short_name = None + self._location = None + self._ports = None + self._private_attributes = None + self.discriminator = None + self.id = id + self.name = name + if short_name is not None: + self.short_name = short_name + self.location = location + self.ports = ports + if private_attributes is not None: + self.private_attributes = private_attributes + + @property + def id(self): + """Gets the id of this Node. # noqa: E501 + + + :return: The id of this Node. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Node. + + + :param id: The id of this Node. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this Node. # noqa: E501 + + + :return: The name of this Node. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Node. + + + :param name: The name of this Node. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 + + self._name = name + + @property + def short_name(self): + """Gets the short_name of this Node. # noqa: E501 + + + :return: The short_name of this Node. # noqa: E501 + :rtype: str + """ + return self._short_name + + @short_name.setter + def short_name(self, short_name): + """Sets the short_name of this Node. + + + :param short_name: The short_name of this Node. # noqa: E501 + :type: str + """ + + self._short_name = short_name + + @property + def location(self): + """Gets the location of this Node. # noqa: E501 + + + :return: The location of this Node. # noqa: E501 + :rtype: Location + """ + return self._location + + @location.setter + def location(self, location): + """Sets the location of this Node. + + + :param location: The location of this Node. # noqa: E501 + :type: Location + """ + if location is None: + raise ValueError( + "Invalid value for `location`, must not be `None`" + ) # noqa: E501 + + self._location = location + + @property + def ports(self): + """Gets the ports of this Node. # noqa: E501 + + + :return: The ports of this Node. # noqa: E501 + :rtype: list[Port] + """ + return self._ports + + @ports.setter + def ports(self, ports): + """Sets the ports of this Node. + + + :param ports: The ports of this Node. # noqa: E501 + :type: list[Port] + """ + if ports is None: + raise ValueError( + "Invalid value for `ports`, must not be `None`" + ) # noqa: E501 + + self._ports = ports + + @property + def private_attributes(self): + """Gets the private_attributes of this Node. # noqa: E501 + + + :return: The private_attributes of this Node. # noqa: E501 + :rtype: list[str] + """ + return self._private_attributes + + @private_attributes.setter + def private_attributes(self, private_attributes): + """Sets the private_attributes of this Node. + + + :param private_attributes: The private_attributes of this Node. # noqa: E501 + :type: list[str] + """ + + self._private_attributes = private_attributes + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(Node, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Node): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/port.py b/sdx_lc_client/models/port.py new file mode 100644 index 0000000..2df73e2 --- /dev/null +++ b/sdx_lc_client/models/port.py @@ -0,0 +1,345 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class Port(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "id": "str", + "name": "str", + "short_name": "str", + "node": "str", + "label_range": "list[str]", + "status": "str", + "state": "str", + "services": "Service", + "private_attributes": "list[str]", + } + + attribute_map = { + "id": "id", + "name": "name", + "short_name": "short_name", + "node": "node", + "label_range": "label_range", + "status": "status", + "state": "state", + "services": "services", + "private_attributes": "private_attributes", + } + + def __init__( + self, + id=None, + name=None, + short_name=None, + node=None, + label_range=None, + status=None, + state=None, + services=None, + private_attributes=None, + ): # noqa: E501 + """Port - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._short_name = None + self._node = None + self._label_range = None + self._status = None + self._state = None + self._services = None + self._private_attributes = None + self.discriminator = None + self.id = id + self.name = name + if short_name is not None: + self.short_name = short_name + self.node = node + if label_range is not None: + self.label_range = label_range + self.status = status + if state is not None: + self.state = state + if services is not None: + self.services = services + if private_attributes is not None: + self.private_attributes = private_attributes + + @property + def id(self): + """Gets the id of this Port. # noqa: E501 + + + :return: The id of this Port. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Port. + + + :param id: The id of this Port. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this Port. # noqa: E501 + + + :return: The name of this Port. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Port. + + + :param name: The name of this Port. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 + + self._name = name + + @property + def short_name(self): + """Gets the short_name of this Port. # noqa: E501 + + + :return: The short_name of this Port. # noqa: E501 + :rtype: str + """ + return self._short_name + + @short_name.setter + def short_name(self, short_name): + """Sets the short_name of this Port. + + + :param short_name: The short_name of this Port. # noqa: E501 + :type: str + """ + + self._short_name = short_name + + @property + def node(self): + """Gets the node of this Port. # noqa: E501 + + + :return: The node of this Port. # noqa: E501 + :rtype: str + """ + return self._node + + @node.setter + def node(self, node): + """Sets the node of this Port. + + + :param node: The node of this Port. # noqa: E501 + :type: str + """ + if node is None: + raise ValueError( + "Invalid value for `node`, must not be `None`" + ) # noqa: E501 + + self._node = node + + @property + def label_range(self): + """Gets the label_range of this Port. # noqa: E501 + + + :return: The label_range of this Port. # noqa: E501 + :rtype: list[str] + """ + return self._label_range + + @label_range.setter + def label_range(self, label_range): + """Sets the label_range of this Port. + + + :param label_range: The label_range of this Port. # noqa: E501 + :type: list[str] + """ + + self._label_range = label_range + + @property + def status(self): + """Gets the status of this Port. # noqa: E501 + + + :return: The status of this Port. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Port. + + + :param status: The status of this Port. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError( + "Invalid value for `status`, must not be `None`" + ) # noqa: E501 + + self._status = status + + @property + def state(self): + """Gets the state of this Port. # noqa: E501 + + + :return: The state of this Port. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Port. + + + :param state: The state of this Port. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def services(self): + """Gets the services of this Port. # noqa: E501 + + + :return: The services of this Port. # noqa: E501 + :rtype: Service + """ + return self._services + + @services.setter + def services(self, services): + """Sets the services of this Port. + + + :param services: The services of this Port. # noqa: E501 + :type: Service + """ + + self._services = services + + @property + def private_attributes(self): + """Gets the private_attributes of this Port. # noqa: E501 + + + :return: The private_attributes of this Port. # noqa: E501 + :rtype: list[str] + """ + return self._private_attributes + + @private_attributes.setter + def private_attributes(self, private_attributes): + """Sets the private_attributes of this Port. + + + :param private_attributes: The private_attributes of this Port. # noqa: E501 + :type: list[str] + """ + + self._private_attributes = private_attributes + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(Port, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Port): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/service.py b/sdx_lc_client/models/service.py new file mode 100644 index 0000000..1a5a2d4 --- /dev/null +++ b/sdx_lc_client/models/service.py @@ -0,0 +1,308 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class Service(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "l2vpn_ptp": "object", + "l2vpn_ptmp": "object", + "monitoring_capability": "str", + "owner": "str", + "private_attributes": "list[str]", + "provisioning_system": "str", + "provisioning_url": "str", + "vendor": "list[str]", + } + + attribute_map = { + "l2vpn_ptp": "l2vpn-ptp", + "l2vpn_ptmp": "l2vpn-ptmp", + "monitoring_capability": "monitoring_capability", + "owner": "owner", + "private_attributes": "private_attributes", + "provisioning_system": "provisioning_system", + "provisioning_url": "provisioning_url", + "vendor": "vendor", + } + + def __init__( + self, + l2vpn_ptp=None, + l2vpn_ptmp=None, + monitoring_capability=None, + owner=None, + private_attributes=None, + provisioning_system=None, + provisioning_url=None, + vendor=None, + ): # noqa: E501 + """Service - a model defined in Swagger""" # noqa: E501 + self._l2vpn_ptp = None + self._l2vpn_ptmp = None + self._monitoring_capability = None + self._owner = None + self._private_attributes = None + self._provisioning_system = None + self._provisioning_url = None + self._vendor = None + self.discriminator = None + if l2vpn_ptp is not None: + self.l2vpn_ptp = l2vpn_ptp + if l2vpn_ptmp is not None: + self.l2vpn_ptmp = l2vpn_ptmp + if monitoring_capability is not None: + self.monitoring_capability = monitoring_capability + if owner is not None: + self.owner = owner + if private_attributes is not None: + self.private_attributes = private_attributes + if provisioning_system is not None: + self.provisioning_system = provisioning_system + if provisioning_url is not None: + self.provisioning_url = provisioning_url + if vendor is not None: + self.vendor = vendor + + @property + def l2vpn_ptp(self): + """Gets the l2vpn_ptp of this Service. # noqa: E501 + + + :return: The l2vpn_ptp of this Service. # noqa: E501 + :rtype: object + """ + return self._l2vpn_ptp + + @l2vpn_ptp.setter + def l2vpn_ptp(self, l2vpn_ptp): + """Sets the l2vpn_ptp of this Service. + + + :param l2vpn_ptp: The l2vpn_ptp of this Service. # noqa: E501 + :type: object + """ + + self._l2vpn_ptp = l2vpn_ptp + + @property + def l2vpn_ptmp(self): + """Gets the l2vpn_ptmp of this Service. # noqa: E501 + + + :return: The l2vpn_ptmp of this Service. # noqa: E501 + :rtype: object + """ + return self._l2vpn_ptmp + + @l2vpn_ptmp.setter + def l2vpn_ptmp(self, l2vpn_ptmp): + """Sets the l2vpn_ptmp of this Service. + + + :param l2vpn_ptmp: The l2vpn_ptmp of this Service. # noqa: E501 + :type: object + """ + + self._l2vpn_ptmp = l2vpn_ptmp + + @property + def monitoring_capability(self): + """Gets the monitoring_capability of this Service. # noqa: E501 + + + :return: The monitoring_capability of this Service. # noqa: E501 + :rtype: str + """ + return self._monitoring_capability + + @monitoring_capability.setter + def monitoring_capability(self, monitoring_capability): + """Sets the monitoring_capability of this Service. + + + :param monitoring_capability: The monitoring_capability of this Service. # noqa: E501 + :type: str + """ + + self._monitoring_capability = monitoring_capability + + @property + def owner(self): + """Gets the owner of this Service. # noqa: E501 + + + :return: The owner of this Service. # noqa: E501 + :rtype: str + """ + return self._owner + + @owner.setter + def owner(self, owner): + """Sets the owner of this Service. + + + :param owner: The owner of this Service. # noqa: E501 + :type: str + """ + + self._owner = owner + + @property + def private_attributes(self): + """Gets the private_attributes of this Service. # noqa: E501 + + + :return: The private_attributes of this Service. # noqa: E501 + :rtype: list[str] + """ + return self._private_attributes + + @private_attributes.setter + def private_attributes(self, private_attributes): + """Sets the private_attributes of this Service. + + + :param private_attributes: The private_attributes of this Service. # noqa: E501 + :type: list[str] + """ + + self._private_attributes = private_attributes + + @property + def provisioning_system(self): + """Gets the provisioning_system of this Service. # noqa: E501 + + + :return: The provisioning_system of this Service. # noqa: E501 + :rtype: str + """ + return self._provisioning_system + + @provisioning_system.setter + def provisioning_system(self, provisioning_system): + """Sets the provisioning_system of this Service. + + + :param provisioning_system: The provisioning_system of this Service. # noqa: E501 + :type: str + """ + + self._provisioning_system = provisioning_system + + @property + def provisioning_url(self): + """Gets the provisioning_url of this Service. # noqa: E501 + + + :return: The provisioning_url of this Service. # noqa: E501 + :rtype: str + """ + return self._provisioning_url + + @provisioning_url.setter + def provisioning_url(self, provisioning_url): + """Sets the provisioning_url of this Service. + + + :param provisioning_url: The provisioning_url of this Service. # noqa: E501 + :type: str + """ + + self._provisioning_url = provisioning_url + + @property + def vendor(self): + """Gets the vendor of this Service. # noqa: E501 + + + :return: The vendor of this Service. # noqa: E501 + :rtype: list[str] + """ + return self._vendor + + @vendor.setter + def vendor(self, vendor): + """Sets the vendor of this Service. + + + :param vendor: The vendor of this Service. # noqa: E501 + :type: list[str] + """ + + self._vendor = vendor + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(Service, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Service): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/topology.py b/sdx_lc_client/models/topology.py new file mode 100644 index 0000000..b03a36f --- /dev/null +++ b/sdx_lc_client/models/topology.py @@ -0,0 +1,351 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class Topology(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "id": "str", + "name": "str", + "services": "Service", + "version": "int", + "model_version": "str", + "timestamp": "datetime", + "nodes": "list[Node]", + "links": "list[Link]", + "private_attributes": "list[str]", + } + + attribute_map = { + "id": "id", + "name": "name", + "services": "services", + "version": "version", + "model_version": "model_version", + "timestamp": "timestamp", + "nodes": "nodes", + "links": "links", + "private_attributes": "private_attributes", + } + + def __init__( + self, + id=None, + name=None, + services=None, + version=None, + model_version=None, + timestamp=None, + nodes=None, + links=None, + private_attributes=None, + ): # noqa: E501 + """Topology - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._services = None + self._version = None + self._model_version = None + self._timestamp = None + self._nodes = None + self._links = None + self._private_attributes = None + self.discriminator = None + self.id = id + self.name = name + if services is not None: + self.services = services + self.version = version + if model_version is not None: + self.model_version = model_version + self.timestamp = timestamp + self.nodes = nodes + self.links = links + if private_attributes is not None: + self.private_attributes = private_attributes + + @property + def id(self): + """Gets the id of this Topology. # noqa: E501 + + + :return: The id of this Topology. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Topology. + + + :param id: The id of this Topology. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this Topology. # noqa: E501 + + + :return: The name of this Topology. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Topology. + + + :param name: The name of this Topology. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError( + "Invalid value for `name`, must not be `None`" + ) # noqa: E501 + + self._name = name + + @property + def services(self): + """Gets the services of this Topology. # noqa: E501 + + + :return: The services of this Topology. # noqa: E501 + :rtype: Service + """ + return self._services + + @services.setter + def services(self, services): + """Sets the services of this Topology. + + + :param services: The services of this Topology. # noqa: E501 + :type: Service + """ + + self._services = services + + @property + def version(self): + """Gets the version of this Topology. # noqa: E501 + + + :return: The version of this Topology. # noqa: E501 + :rtype: int + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this Topology. + + + :param version: The version of this Topology. # noqa: E501 + :type: int + """ + if version is None: + raise ValueError( + "Invalid value for `version`, must not be `None`" + ) # noqa: E501 + + self._version = version + + @property + def model_version(self): + """Gets the model_version of this Topology. # noqa: E501 + + + :return: The model_version of this Topology. # noqa: E501 + :rtype: str + """ + return self._model_version + + @model_version.setter + def model_version(self, model_version): + """Sets the model_version of this Topology. + + + :param model_version: The model_version of this Topology. # noqa: E501 + :type: str + """ + + self._model_version = model_version + + @property + def timestamp(self): + """Gets the timestamp of this Topology. # noqa: E501 + + + :return: The timestamp of this Topology. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this Topology. + + + :param timestamp: The timestamp of this Topology. # noqa: E501 + :type: datetime + """ + if timestamp is None: + raise ValueError( + "Invalid value for `timestamp`, must not be `None`" + ) # noqa: E501 + + self._timestamp = timestamp + + @property + def nodes(self): + """Gets the nodes of this Topology. # noqa: E501 + + + :return: The nodes of this Topology. # noqa: E501 + :rtype: list[Node] + """ + return self._nodes + + @nodes.setter + def nodes(self, nodes): + """Sets the nodes of this Topology. + + + :param nodes: The nodes of this Topology. # noqa: E501 + :type: list[Node] + """ + if nodes is None: + raise ValueError( + "Invalid value for `nodes`, must not be `None`" + ) # noqa: E501 + + self._nodes = nodes + + @property + def links(self): + """Gets the links of this Topology. # noqa: E501 + + + :return: The links of this Topology. # noqa: E501 + :rtype: list[Link] + """ + return self._links + + @links.setter + def links(self, links): + """Sets the links of this Topology. + + + :param links: The links of this Topology. # noqa: E501 + :type: list[Link] + """ + if links is None: + raise ValueError( + "Invalid value for `links`, must not be `None`" + ) # noqa: E501 + + self._links = links + + @property + def private_attributes(self): + """Gets the private_attributes of this Topology. # noqa: E501 + + + :return: The private_attributes of this Topology. # noqa: E501 + :rtype: list[str] + """ + return self._private_attributes + + @private_attributes.setter + def private_attributes(self, private_attributes): + """Sets the private_attributes of this Topology. + + + :param private_attributes: The private_attributes of this Topology. # noqa: E501 + :type: list[str] + """ + + self._private_attributes = private_attributes + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(Topology, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Topology): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/models/user.py b/sdx_lc_client/models/user.py new file mode 100644 index 0000000..307e188 --- /dev/null +++ b/sdx_lc_client/models/user.py @@ -0,0 +1,310 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + + +class User(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + "id": "int", + "username": "str", + "first_name": "str", + "last_name": "str", + "email": "str", + "password": "str", + "phone": "str", + "user_status": "int", + } + + attribute_map = { + "id": "id", + "username": "username", + "first_name": "firstName", + "last_name": "lastName", + "email": "email", + "password": "password", + "phone": "phone", + "user_status": "userStatus", + } + + def __init__( + self, + id=None, + username=None, + first_name=None, + last_name=None, + email=None, + password=None, + phone=None, + user_status=None, + ): # noqa: E501 + """User - a model defined in Swagger""" # noqa: E501 + self._id = None + self._username = None + self._first_name = None + self._last_name = None + self._email = None + self._password = None + self._phone = None + self._user_status = None + self.discriminator = None + if id is not None: + self.id = id + if username is not None: + self.username = username + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if email is not None: + self.email = email + if password is not None: + self.password = password + if phone is not None: + self.phone = phone + if user_status is not None: + self.user_status = user_status + + @property + def id(self): + """Gets the id of this User. # noqa: E501 + + + :return: The id of this User. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + + :param id: The id of this User. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def username(self): + """Gets the username of this User. # noqa: E501 + + + :return: The username of this User. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this User. + + + :param username: The username of this User. # noqa: E501 + :type: str + """ + + self._username = username + + @property + def first_name(self): + """Gets the first_name of this User. # noqa: E501 + + + :return: The first_name of this User. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + + :param first_name: The first_name of this User. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. # noqa: E501 + + + :return: The last_name of this User. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + + :param last_name: The last_name of this User. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def email(self): + """Gets the email of this User. # noqa: E501 + + + :return: The email of this User. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this User. + + + :param email: The email of this User. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def password(self): + """Gets the password of this User. # noqa: E501 + + + :return: The password of this User. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this User. + + + :param password: The password of this User. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def phone(self): + """Gets the phone of this User. # noqa: E501 + + + :return: The phone of this User. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this User. + + + :param phone: The phone of this User. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def user_status(self): + """Gets the user_status of this User. # noqa: E501 + + User Status # noqa: E501 + + :return: The user_status of this User. # noqa: E501 + :rtype: int + """ + return self._user_status + + @user_status.setter + def user_status(self, user_status): + """Sets the user_status of this User. + + User Status # noqa: E501 + + :param user_status: The user_status of this User. # noqa: E501 + :type: int + """ + + self._user_status = user_status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: ( + (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item + ), + value.items(), + ) + ) + else: + result[attr] = value + if issubclass(User, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, User): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/sdx_lc_client/rest.py b/sdx_lc_client/rest.py new file mode 100644 index 0000000..433270a --- /dev/null +++ b/sdx_lc_client/rest.py @@ -0,0 +1,412 @@ +# coding: utf-8 + +""" + SDX LC + + You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 + + OpenAPI spec version: 2.0.0 + Contact: yxin@renci.org + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError("Swagger python client requires urllib3.") + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.headers.get(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args["assert_hostname"] = ( + configuration.assert_hostname + ) # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request( + self, + method, + url, + query_params=None, + headers=None, + body=None, + post_params=None, + _preload_content=True, + _request_timeout=None, + ): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance( + _request_timeout, (int,) if six.PY3 else (int, long) + ): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1] + ) + + if "Content-Type" not in headers: + headers["Content-Type"] = "application/json" + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: + if query_params: + url += "?" + urlencode(query_params) + if re.search("json", headers["Content-Type"], re.IGNORECASE): + request_body = "{}" + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers, + ) + elif ( + headers["Content-Type"] == "application/x-www-form-urlencoded" + ): # noqa: E501 + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers, + ) + elif headers["Content-Type"] == "multipart/form-data": + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers["Content-Type"] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers, + ) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str): + request_body = body + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers, + ) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers, + ) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + def GET( + self, + url, + headers=None, + query_params=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "GET", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def HEAD( + self, + url, + headers=None, + query_params=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "HEAD", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def OPTIONS( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "OPTIONS", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def DELETE( + self, + url, + headers=None, + query_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "DELETE", + url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def POST( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "POST", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PUT( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PUT", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PATCH( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PATCH", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format(self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message From 0cc85f4f8dc58c7660f880c630efbe6d6b431223 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 16:47:09 -0400 Subject: [PATCH 09/13] unittest --- test/__init__.py | 1 - test/test_api_response.py | 2 +- test/test_connection.py | 2 +- test/test_connection_api.py | 31 ++++++++++++++++++-- test/test_link.py | 2 +- test/test_link_api.py | 2 +- test/test_link_measurement_period.py | 6 ++-- test/test_location.py | 2 +- test/test_node.py | 2 +- test/test_node_api.py | 29 ++++++++++++++++-- test/test_port.py | 2 +- test/test_service.py | 2 +- test/test_topology.py | 2 +- test/test_topology_api.py | 44 ++++++++++++++++++++++++++-- test/test_user.py | 2 +- test/test_user_api.py | 2 +- 16 files changed, 109 insertions(+), 24 deletions(-) diff --git a/test/__init__.py b/test/__init__.py index 57d631c..e69de29 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1 +0,0 @@ -# coding: utf-8 diff --git a/test/test_api_response.py b/test/test_api_response.py index 5394e2d..8d30377 100644 --- a/test/test_api_response.py +++ b/test/test_api_response.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_connection.py b/test/test_connection.py index 4409996..3723e62 100644 --- a/test/test_connection.py +++ b/test/test_connection.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_connection_api.py b/test/test_connection_api.py index 9305ef3..53fd679 100644 --- a/test/test_connection_api.py +++ b/test/test_connection_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -44,10 +44,35 @@ def test_getconnection_by_id(self): def test_place_connection(self): """Test case for place_connection - Place an connection request from the SDX-Controller # noqa: E501 """ - pass + p1 = sdx_lc_client.Port( + id="n1:p1", name="p1", short_name="eth1", node="n1", status="UP" + ) + p2 = sdx_lc_client.Port( + id="n2:p1", name="p2", short_name="eth2", node="n2", status="UP" + ) + timestmp = "2021-06-24T00:05:23+04:00" + connection_body = sdx_lc_client.Connection( + id="test1", + name="test1", + ingress_port=p1, + egress_port=p2, + start_time=timestmp, + end_time=timestmp, + ) + try: + # create a connection + # logger.warning(connection_body) + api_response = self.api.place_connection(connection_body) + print(api_response) + # logger.warning(api_response) + except ApiException as e: + print(e) + # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) + return False + + return True if __name__ == "__main__": diff --git a/test/test_link.py b/test/test_link.py index 10c22b2..291687c 100644 --- a/test/test_link.py +++ b/test/test_link.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_link_api.py b/test/test_link_api.py index 58bca71..4128af3 100644 --- a/test/test_link_api.py +++ b/test/test_link_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_link_measurement_period.py b/test/test_link_measurement_period.py index ad644ad..6963e56 100644 --- a/test/test_link_measurement_period.py +++ b/test/test_link_measurement_period.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -15,9 +15,9 @@ import unittest import sdx_lc_client -from sdx_lc_client.models.link_measurement_period import ( +from sdx_lc_client.models.link_measurement_period import ( # noqa: E501 LinkMeasurementPeriod, -) # noqa: E501 +) from sdx_lc_client.rest import ApiException diff --git a/test/test_location.py b/test/test_location.py index 653dfaf..a4f9276 100644 --- a/test/test_location.py +++ b/test/test_location.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_node.py b/test/test_node.py index a2a745b..54625e3 100644 --- a/test/test_node.py +++ b/test/test_node.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_node_api.py b/test/test_node_api.py index b293633..afdf7ca 100644 --- a/test/test_node_api.py +++ b/test/test_node_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -30,10 +30,33 @@ def tearDown(self): def test_add_node(self): """Test case for add_node - add a new node to the topology # noqa: E501 """ - pass + p1 = sdx_lc_client.Port( + id="n1:p1", name="p1", short_name="eth1", node="n1", status="UP" + ) + p2 = sdx_lc_client.Port( + id="n2:p1", name="p2", short_name="eth2", node="n2", status="UP" + ) + ps = [] + ps.append(p1) + # ps.append(p2) + lt = sdx_lc_client.Location( + address="miami", latitude=-28.51107891831147, longitude=-79.57947854792273 + ) + node_body = sdx_lc_client.Node(id="test1", name="test1", location=lt, ports=ps) + try: + # create a connection + # logger.warning(connection_body) + api_response = self.api.add_node(node_body) + print(api_response) + # logger.warning(api_response) + except ApiException as e: + print(e) + # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) + return False + + return True def test_delete_node(self): """Test case for delete_node diff --git a/test/test_port.py b/test/test_port.py index 0b8f7a8..800dfd2 100644 --- a/test/test_port.py +++ b/test/test_port.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_service.py b/test/test_service.py index 893449d..bc50af1 100644 --- a/test/test_service.py +++ b/test/test_service.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_topology.py b/test/test_topology.py index b4f567f..07b067e 100644 --- a/test/test_topology.py +++ b/test/test_topology.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_topology_api.py b/test/test_topology_api.py index 67769b6..2094c76 100644 --- a/test/test_topology_api.py +++ b/test/test_topology_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -30,10 +30,48 @@ def tearDown(self): def test_add_topology(self): """Test case for add_topology - Send a new topology to SDX-LC # noqa: E501 """ - pass + p1 = sdx_lc_client.Port( + id="n1:p1", name="p1", short_name="eth1", node="n1", status="UP" + ) + p2 = sdx_lc_client.Port( + id="n2:p1", name="p2", short_name="eth2", node="n2", status="UP" + ) + ps = [] + ps.append(p1) + ps.append(p2) + lt = sdx_lc_client.Location(address="miami") + node = sdx_lc_client.Node(id="node1", name="node1", location=lt, ports=ps) + ns = [] + ns.append(node) + + link = sdx_lc_client.Link(id="link1", name="link1", ports=ps) + ls = [] + ls.append(link) + + timestmp = "2021-06-24T04:56:07+00:00" + topology_body = sdx_lc_client.Topology( + id="topology1", + name="topology1", + nodes=ns, + links=ls, + version=1, + time_stamp=timestmp, + ) + + try: + # create a connection + # logger.warning(connection_body) + api_response = self.api.add_topology(topology_body) + print(api_response) + # logger.warning(api_response) + except ApiException as e: + print(e) + # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) + return False + + return True def test_delete_topology(self): """Test case for delete_topology diff --git a/test/test_user.py b/test/test_user.py index 6dac879..0fff632 100644 --- a/test/test_user.py +++ b/test/test_user.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/test/test_user_api.py b/test/test_user_api.py index 0086f1f..6ae5bf1 100644 --- a/test/test_user_api.py +++ b/test/test_user_api.py @@ -5,7 +5,7 @@ You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501 - OpenAPI spec version: 2.0.0 + OpenAPI spec version: 1.0.0 Contact: yxin@renci.org Generated by: https://github.com/swagger-api/swagger-codegen.git """ From e3048510d697408942934f490a3794de43573695 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 16:56:01 -0400 Subject: [PATCH 10/13] no return in test --- test/test_connection_api.py | 3 --- test/test_link_measurement_period.py | 4 ++-- test/test_node_api.py | 3 --- test/test_topology_api.py | 5 +---- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/test/test_connection_api.py b/test/test_connection_api.py index 53fd679..65e4aac 100644 --- a/test/test_connection_api.py +++ b/test/test_connection_api.py @@ -70,9 +70,6 @@ def test_place_connection(self): except ApiException as e: print(e) # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) - return False - - return True if __name__ == "__main__": diff --git a/test/test_link_measurement_period.py b/test/test_link_measurement_period.py index 6963e56..50a18f4 100644 --- a/test/test_link_measurement_period.py +++ b/test/test_link_measurement_period.py @@ -15,9 +15,9 @@ import unittest import sdx_lc_client -from sdx_lc_client.models.link_measurement_period import ( # noqa: E501 +from sdx_lc_client.models.link_measurement_period import ( LinkMeasurementPeriod, -) +) # noqa: E501 from sdx_lc_client.rest import ApiException diff --git a/test/test_node_api.py b/test/test_node_api.py index afdf7ca..155a779 100644 --- a/test/test_node_api.py +++ b/test/test_node_api.py @@ -54,9 +54,6 @@ def test_add_node(self): except ApiException as e: print(e) # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) - return False - - return True def test_delete_node(self): """Test case for delete_node diff --git a/test/test_topology_api.py b/test/test_topology_api.py index 2094c76..70a9987 100644 --- a/test/test_topology_api.py +++ b/test/test_topology_api.py @@ -57,7 +57,7 @@ def test_add_topology(self): nodes=ns, links=ls, version=1, - time_stamp=timestmp, + timestamp=timestmp, ) try: @@ -69,9 +69,6 @@ def test_add_topology(self): except ApiException as e: print(e) # logger.warning("Exception when calling ConnectionApi->place_experiment: %s\n" % e) - return False - - return True def test_delete_topology(self): """Test case for delete_topology From 754293ae0ce470a62fb96a34b5e176533423a230 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 16:59:32 -0400 Subject: [PATCH 11/13] long->int --- sdx_lc_client/rest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdx_lc_client/rest.py b/sdx_lc_client/rest.py index 433270a..62538bf 100644 --- a/sdx_lc_client/rest.py +++ b/sdx_lc_client/rest.py @@ -150,7 +150,7 @@ def request( timeout = None if _request_timeout: if isinstance( - _request_timeout, (int,) if six.PY3 else (int, long) + _request_timeout, (int,) if six.PY3 else (int, int) ): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: From 4e72f1af84a0461f6afdc99a94ee6dc6d4141b43 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 7 May 2024 17:03:34 -0400 Subject: [PATCH 12/13] tox --- tox.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 55e9524..acefbd2 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,8 @@ envlist = py3 [testenv] deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt - -passenv = SDXLC_* + pytest>=7.1.2 + pytest-cov>=3.0.0 +passenv = SDXLC_*, MQ_*, SUB_*, DB_*, MONGODB_CONNSTRING commands = pytest --cov=sdx_lc_client {posargs} From 514324662e79afa22108b014b592cd538c68de8c Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Wed, 8 May 2024 00:53:11 -0400 Subject: [PATCH 13/13] update --- sdx_lc_client/.DS_Store | Bin 6148 -> 0 bytes sdx_lc_client/models/port.py | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) delete mode 100644 sdx_lc_client/.DS_Store diff --git a/sdx_lc_client/.DS_Store b/sdx_lc_client/.DS_Store deleted file mode 100644 index c43ee62a22d53cc75b181ee2096e26474c200495..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKI|>3p3{6x-u(7n9D|mxJ^aNf&bnRBQ5c{n>mq+vEgCMJoU?VS(yqQeiEc=Sh zMnrUdZB`-+5t+da_=qr~nmsDq!D-0ynIQeV~6j5PSpxPLOuP+Gh!1u>`Ot z_JPR2G^oI!YK|BhbmU9c)xw_p_5UsW z!~FkB;*JVXfxl8fC!5`7jaSOvI(RwjwFSP1Tg@GAhP6`=yd49*9b;qdc* Wn%Da;(5S$#6?gza5EYvM diff --git a/sdx_lc_client/models/port.py b/sdx_lc_client/models/port.py index 2df73e2..4afaf3e 100644 --- a/sdx_lc_client/models/port.py +++ b/sdx_lc_client/models/port.py @@ -37,6 +37,7 @@ class Port(object): "label_range": "list[str]", "status": "str", "state": "str", + "nni": "str", "services": "Service", "private_attributes": "list[str]", } @@ -49,6 +50,7 @@ class Port(object): "label_range": "label_range", "status": "status", "state": "state", + "nni": "nni", "services": "services", "private_attributes": "private_attributes", } @@ -62,6 +64,7 @@ def __init__( label_range=None, status=None, state=None, + nni=None, services=None, private_attributes=None, ): # noqa: E501 @@ -73,6 +76,7 @@ def __init__( self._label_range = None self._status = None self._state = None + self._nni = None self._services = None self._private_attributes = None self.discriminator = None @@ -86,6 +90,8 @@ def __init__( self.status = status if state is not None: self.state = state + if nni is not None: + self.nni = nni if services is not None: self.services = services if private_attributes is not None: @@ -252,6 +258,27 @@ def state(self, state): self._state = state + @property + def nni(self): + """Gets the nni of this Port. # noqa: E501 + + + :return: The nni of this Port. # noqa: E501 + :rtype: str + """ + return self._nni + + @nni.setter + def nni(self, nni): + """Sets the nni of this Port. + + + :param nni: The nni of this Port. # noqa: E501 + :type: str + """ + + self._nni = nni + @property def services(self): """Gets the services of this Port. # noqa: E501