summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--multivimbroker/multivimbroker/forwarder/base.py26
-rw-r--r--multivimbroker/multivimbroker/forwarder/urls.py9
-rw-r--r--multivimbroker/multivimbroker/forwarder/views.py54
-rw-r--r--multivimbroker/multivimbroker/pub/database/models.py4
-rw-r--r--multivimbroker/multivimbroker/pub/exceptions.py8
-rw-r--r--multivimbroker/multivimbroker/pub/msapi/extsys.py8
-rw-r--r--multivimbroker/multivimbroker/pub/utils/restcall.py45
-rwxr-xr-xmultivimbroker/multivimbroker/pub/utils/share_lock.py16
-rw-r--r--multivimbroker/multivimbroker/pub/utils/syscomm.py21
-rw-r--r--multivimbroker/multivimbroker/pub/utils/values.py1
-rw-r--r--multivimbroker/multivimbroker/samples/tests.py3
-rw-r--r--multivimbroker/multivimbroker/settings.py9
-rw-r--r--multivimbroker/multivimbroker/swagger/tests.py5
-rw-r--r--multivimbroker/multivimbroker/swagger/urls.py4
-rw-r--r--multivimbroker/multivimbroker/swagger/views.py40
-rw-r--r--multivimbroker/tox.ini6
16 files changed, 154 insertions, 105 deletions
diff --git a/multivimbroker/multivimbroker/forwarder/base.py b/multivimbroker/multivimbroker/forwarder/base.py
index 8f70c8b..c96461a 100644
--- a/multivimbroker/multivimbroker/forwarder/base.py
+++ b/multivimbroker/multivimbroker/forwarder/base.py
@@ -23,9 +23,10 @@ from multivimbroker.pub.utils.restcall import req_by_msb
logger = logging.getLogger(__name__)
+
class BaseHandler(object):
- def _request(self,route_uri,method,body="",headers=None):
+ def _request(self, route_uri, method, body="", headers=None):
try:
retcode, content, status_code, resp = \
@@ -48,18 +49,17 @@ class BaseHandler(object):
response[k] = resp[k]
return response
+ def send(self, vimid, full_path, body, method, headers=None):
- def send(self,vimid,full_path,body,method,headers=None):
-
- try:
- url = getMultivimDriver(vimid,full_path=full_path)
-
- except exceptions.VimBrokerException as e:
- logging.exception("vimbroker exception: %s"%e)
- return HttpResponse(e.content,status=e.status_code)
- except Exception as e:
- logging.exception("unkown exception: %s" %e)
- return HttpResponse(str(e),status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ try:
+ url = getMultivimDriver(vimid, full_path=full_path)
- return self._request(url,method,body=body,headers=headers)
+ except exceptions.VimBrokerException as e:
+ logging.exception("vimbroker exception: %s" % e)
+ return HttpResponse(e.content, status=e.status_code)
+ except Exception as e:
+ logging.exception("unkown exception: %s" % e)
+ return HttpResponse(str(e),
+ status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ return self._request(url, method, body=body, headers=headers)
diff --git a/multivimbroker/multivimbroker/forwarder/urls.py b/multivimbroker/multivimbroker/forwarder/urls.py
index b63c4af..2caa219 100644
--- a/multivimbroker/multivimbroker/forwarder/urls.py
+++ b/multivimbroker/multivimbroker/forwarder/urls.py
@@ -20,9 +20,12 @@ from multivimbroker.forwarder.views import Identity
urlpatterns = [
- url(r'^api/multicloud/v0/(?P<vimid>[0-9a-zA-Z_-]+)/identity/v3$',Identity.as_view()),
- url(r'^api/multicloud/v0/(?P<vimid>[0-9a-zA-Z_-]+)/identity/v3/auth/tokens$',Identity.as_view()),
- url(r'^api/multicloud/v0/(?P<vimid>[0-9a-zA-Z_-]+)', Forward.as_view()),
+ url(r'^api/multicloud/v0/(?P<vimid>[0-9a-zA-Z_-]+)/identity/v3$',
+ Identity.as_view()),
+ url(r'^api/multicloud/v0/(?P<vimid>[0-9a-zA-Z_-]+)/\
+ identity/v3/auth/tokens$', Identity.as_view()),
+ url(r'^api/multicloud/v0/(?P<vimid>[0-9a-zA-Z_-]+)',
+ Forward.as_view()),
]
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py
index 82759e5..ed67977 100644
--- a/multivimbroker/multivimbroker/forwarder/views.py
+++ b/multivimbroker/multivimbroker/forwarder/views.py
@@ -12,68 +12,72 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from rest_framework.views import APIView
+from rest_framework.views import APIView
from multivimbroker.forwarder.base import BaseHandler
#
-class BaseServer(BaseHandler,APIView):
- def get(self,request,vimid):
+class BaseServer(BaseHandler, APIView):
+
+ def get(self, request, vimid):
raise NotImplementedError()
- def post(self,request,vimid):
+ def post(self, request, vimid):
raise NotImplementedError()
- def put(self,request,vimid):
+ def put(self, request, vimid):
raise NotImplementedError()
- def delete(self,request,vimid):
+ def delete(self, request, vimid):
raise NotImplementedError()
- def head(self,request,vimid):
+ def head(self, request, vimid):
raise NotImplementedError()
- def patch(self,request,vimid):
+ def patch(self, request, vimid):
raise NotImplementedError()
# vio proxy handler
class Identity(BaseServer):
- def get(self,request,vimid):
+ def get(self, request, vimid):
- return self.send(vimid,request.get_full_path(),request.body,"GET")
+ return self.send(vimid, request.get_full_path(), request.body, "GET")
- def post(self,request,vimid):
+ def post(self, request, vimid):
- return self.send(vimid,request.get_full_path(),request.body,"POST")
+ return self.send(vimid, request.get_full_path(), request.body, "POST")
# forward handler
class Forward(BaseServer):
- def get(self,request,vimid):
-
- return self.send(vimid,request.get_full_path(),request.body,"GET")
+ def get(self, request, vimid):
- def post(self,request,vimid):
+ return self.send(vimid, request.get_full_path(), request.body, "GET")
- return self.send(vimid,request.get_full_path(),request.body,"POST",headers=None)
+ def post(self, request, vimid):
- def patch(self,request,vimid):
+ return self.send(vimid, request.get_full_path(), request.body, "POST",
+ headers=None)
- return self.send(vimid,request.get_full_path(),request.body,"PATCH",headers=None)
+ def patch(self, request, vimid):
- def delete(self,request,vimid):
+ return self.send(vimid, request.get_full_path(), request.body, "PATCH",
+ headers=None)
- return self.send(vimid,request.get_full_path(),request.body,"DELETE",headers=None)
+ def delete(self, request, vimid):
- def head(self,request,vimid):
+ return self.send(vimid, request.get_full_path(), request.body,
+ "DELETE", headers=None)
- return self.send(vimid,request.get_full_path(),request.body,"HEAD")
+ def head(self, request, vimid):
- def put(self,request,vimid):
+ return self.send(vimid, request.get_full_path(), request.body, "HEAD")
- return self.send(vimid,request.get_full_path(),request.body,"PUT",headers=None)
+ def put(self, request, vimid):
+ return self.send(vimid, request.get_full_path(), request.body, "PUT",
+ headers=None)
diff --git a/multivimbroker/multivimbroker/pub/database/models.py b/multivimbroker/multivimbroker/pub/database/models.py
index 0a23fc4..b30efb4 100644
--- a/multivimbroker/multivimbroker/pub/database/models.py
+++ b/multivimbroker/multivimbroker/pub/database/models.py
@@ -11,10 +11,12 @@
from django.db import models
+
class VimInstModel(models.Model):
class Meta:
db_table = 'vim_inst_type_mapping'
- vimid = models.CharField(db_column='VIMID', primary_key=True, max_length=200)
+ vimid = models.CharField(
+ db_column='VIMID', primary_key=True, max_length=200)
vimtype = models.CharField(db_column="VIMTYPE", max_length=200)
viminst_url = models.CharField(db_column="VIMINSTURL", max_length=200)
diff --git a/multivimbroker/multivimbroker/pub/exceptions.py b/multivimbroker/multivimbroker/pub/exceptions.py
index d2b2c80..6553702 100644
--- a/multivimbroker/multivimbroker/pub/exceptions.py
+++ b/multivimbroker/multivimbroker/pub/exceptions.py
@@ -10,7 +10,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-
class BaseException(Exception):
message = "Exception"
@@ -21,13 +20,12 @@ class BaseException(Exception):
self.status_code = status_code
self.content = content
+
class VimBrokerException(BaseException):
- message = "vim error"
+ message = "vim error"
class NotFound(BaseException):
- message = "not found error"
-
-
+ message = "not found error"
diff --git a/multivimbroker/multivimbroker/pub/msapi/extsys.py b/multivimbroker/multivimbroker/pub/msapi/extsys.py
index 1baa08a..75959a4 100644
--- a/multivimbroker/multivimbroker/pub/msapi/extsys.py
+++ b/multivimbroker/multivimbroker/pub/msapi/extsys.py
@@ -23,7 +23,8 @@ def get_vims():
ret = req_by_msb(ESR_GET_VIM_URI, "GET")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
- raise VimBrokerException(status_code=404 ,content="Failed to query VIMs from extsys.")
+ raise VimBrokerException(
+ status_code=404, content="Failed to query VIMs from extsys.")
return json.JSONDecoder().decode(ret[1])
@@ -31,6 +32,7 @@ def get_vim_by_id(vim_id):
ret = req_by_msb("%s/%s" % (ESR_GET_VIM_URI, vim_id), "GET")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
- raise VimBrokerException(status_code=404,content=
- "Failed to query VIM with id (%s) from extsys." % vim_id)
+ raise VimBrokerException(
+ status_code=404,
+ content="Failed to query VIM with id (%s) from extsys." % vim_id)
return json.JSONDecoder().decode(ret[1])
diff --git a/multivimbroker/multivimbroker/pub/utils/restcall.py b/multivimbroker/multivimbroker/pub/utils/restcall.py
index dc0b822..b25b389 100644
--- a/multivimbroker/multivimbroker/pub/utils/restcall.py
+++ b/multivimbroker/multivimbroker/pub/utils/restcall.py
@@ -20,39 +20,49 @@ import httplib2
from multivimbroker.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT
rest_no_auth, rest_oneway_auth, rest_bothway_auth = 0, 1, 2
-HTTP_200_OK, HTTP_201_CREATED, HTTP_204_NO_CONTENT, HTTP_202_ACCEPTED = '200', '201', '204', '202'
-status_ok_list = [HTTP_200_OK, HTTP_201_CREATED, HTTP_204_NO_CONTENT, HTTP_202_ACCEPTED]
-HTTP_404_NOTFOUND, HTTP_403_FORBIDDEN, HTTP_401_UNAUTHORIZED, HTTP_400_BADREQUEST = '404', '403', '401', '400'
+HTTP_200_OK, HTTP_201_CREATED = '200', '201'
+HTTP_204_NO_CONTENT, HTTP_202_ACCEPTED = '204', '202'
+status_ok_list = [HTTP_200_OK, HTTP_201_CREATED,
+ HTTP_204_NO_CONTENT, HTTP_202_ACCEPTED]
+HTTP_404_NOTFOUND, HTTP_403_FORBIDDEN = '404', '403'
+HTTP_401_UNAUTHORIZED, HTTP_400_BADREQUEST = '401', '400'
logger = logging.getLogger(__name__)
-def call_req(base_url, user, passwd, auth_type, resource, method, content='',headers=None):
+def call_req(base_url, user, passwd, auth_type, resource, method,
+ content='', headers=None):
callid = str(uuid.uuid1())
# logger.debug("[%s]call_req('%s','%s','%s',%s,'%s','%s','%s')" % (
-# callid, base_url, user, passwd, auth_type, resource, method, content))
+# callid, base_url, user, passwd, auth_type, resource, method, content))
ret = None
resp_status = ''
resp = ""
full_url = ""
-
try:
full_url = combine_url(base_url, resource)
- if headers == None:
+ if headers is None:
headers = {}
- headers['content-type']='application/json'
+ headers['content-type'] = 'application/json'
if user:
- headers['Authorization'] = 'Basic ' + ('%s:%s' % (user, passwd)).encode("base64")
+ headers['Authorization'] = 'Basic ' + \
+ ('%s:%s' % (user, passwd)).encode("base64")
ca_certs = None
for retry_times in range(3):
- http = httplib2.Http(ca_certs=ca_certs, disable_ssl_certificate_validation=(auth_type == rest_no_auth))
+ http = httplib2.Http(
+ ca_certs=ca_certs,
+ disable_ssl_certificate_validation=(
+ auth_type == rest_no_auth))
http.follow_all_redirects = True
try:
logger.debug("request=%s)" % full_url)
- resp, resp_content = http.request(full_url, method=method.upper(), body=content, headers=headers)
- resp_status, resp_body = resp['status'], resp_content.decode('UTF-8')
+ resp, resp_content = http.request(
+ full_url, method=method.upper(),
+ body=content, headers=headers)
+ resp_status, resp_body = resp['status'], resp_content.decode(
+ 'UTF-8')
if resp_status in status_ok_list:
ret = [0, resp_body, resp_status, resp]
@@ -62,7 +72,8 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content='',hea
except Exception as ex:
if 'httplib.ResponseNotReady' in str(sys.exc_info()):
logger.error(traceback.format_exc())
- ret = [1, "Unable to connect to %s" % full_url, resp_status, resp]
+ ret = [1, "Unable to connect to %s" %
+ full_url, resp_status, resp]
continue
raise ex
except urllib2.URLError as err:
@@ -72,7 +83,8 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content='',hea
logger.error("[%s]ret=%s" % (callid, str(sys.exc_info())))
res_info = str(sys.exc_info())
if 'httplib.ResponseNotReady' in res_info:
- res_info = "The URL[%s] request failed or is not responding." % full_url
+ res_info = "The URL[%s] request \
+ failed or is not responding." % full_url
ret = [3, res_info, resp_status, resp]
except:
logger.error(traceback.format_exc())
@@ -82,9 +94,10 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content='',hea
return ret
-def req_by_msb(resource, method, content='',headers=None):
+def req_by_msb(resource, method, content='', headers=None):
base_url = "http://%s:%s/" % (MSB_SERVICE_IP, MSB_SERVICE_PORT)
- return call_req(base_url, "", "", rest_no_auth, resource, method, content,headers)
+ return call_req(base_url, "", "",
+ rest_no_auth, resource, method, content, headers)
def combine_url(base_url, resource):
diff --git a/multivimbroker/multivimbroker/pub/utils/share_lock.py b/multivimbroker/multivimbroker/pub/utils/share_lock.py
index b594c68..c79f685 100755
--- a/multivimbroker/multivimbroker/pub/utils/share_lock.py
+++ b/multivimbroker/multivimbroker/pub/utils/share_lock.py
@@ -15,21 +15,26 @@ import time
import redis
-from multivimbroker.pub.config.config import REDIS_HOST, REDIS_PORT, REDIS_PASSWD
+from multivimbroker.pub.config.config import REDIS_HOST
+from multivimbroker.pub.config.config import REDIS_PORT
+from multivimbroker.pub.config.config import REDIS_PASSWD
class SharedLock:
- def __init__(self, lock_key, host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWD, db=9, lock_timeout=5 * 60):
+ def __init__(self, lock_key, host=REDIS_HOST, port=REDIS_PORT,
+ password=REDIS_PASSWD, db=9, lock_timeout=5 * 60):
self.lock_key = lock_key
self.lock_timeout = lock_timeout
- self.redis = redis.Redis(host=host, port=port, db=db, password=password)
+ self.redis = redis.Redis(host=host, port=port,
+ db=db, password=password)
self.acquire_time = -1
def acquire(self):
begin = now = int(time.time())
while (now - begin) < self.lock_timeout:
- result = self.redis.setnx(self.lock_key, now + self.lock_timeout + 1)
+ result = self.redis.setnx(self.lock_key, now +
+ self.lock_timeout + 1)
if result == 1 or result is True:
self.acquire_time = now
return True
@@ -42,7 +47,8 @@ class SharedLock:
current_lock_timestamp = int(current_lock_timestamp)
if now > current_lock_timestamp:
- next_lock_timestamp = self.redis.getset(self.lock_key, now + self.lock_timeout + 1)
+ next_lock_timestamp = self.redis.getset(self.lock_key, now +
+ self.lock_timeout + 1)
if not next_lock_timestamp:
time.sleep(1)
continue
diff --git a/multivimbroker/multivimbroker/pub/utils/syscomm.py b/multivimbroker/multivimbroker/pub/utils/syscomm.py
index 07606bf..0d0419a 100644
--- a/multivimbroker/multivimbroker/pub/utils/syscomm.py
+++ b/multivimbroker/multivimbroker/pub/utils/syscomm.py
@@ -12,23 +12,27 @@
import inspect
import re
-import multivimbroker.pub.exceptions as exceptions
+import multivimbroker.pub.exceptions as exceptions
from multivimbroker.pub.msapi.extsys import get_vim_by_id
+
+
def fun_name():
return inspect.stack()[1][3]
+# Which headers are hop-by-hop headers by default
+HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate',
+ 'proxy-authorization', 'te', 'trailers',
+ 'transfer-encoding', 'upgrade']
-# Which headers are hop-by-hop headers by default
-HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
def getHeadersKeys(response):
hopbyhop = HOP_BY_HOP
- hopbyhop.extend([x.strip() for x in response.get('connection', '').split(',')])
+ hopbyhop.extend([x.strip()
+ for x in response.get('connection', '').split(',')])
return [header for header in response.keys() if header not in hopbyhop]
-
def findMultivimDriver(vim=None):
if vim and vim["type"] == "openstack":
@@ -42,12 +46,11 @@ def findMultivimDriver(vim=None):
elif vim and vim["type"] == "vmware":
multivimdriver = "multivim-vio"
else:
- raise exceptions.NotFound("Not support VIM type")
- return multivimdriver
-
+ raise exceptions.NotFound("Not support VIM type")
+ return multivimdriver
-def getMultivimDriver(vimid,full_path=""):
+def getMultivimDriver(vimid, full_path=""):
multivim = "multivim"
vim = get_vim_by_id(vimid)
diff --git a/multivimbroker/multivimbroker/pub/utils/values.py b/multivimbroker/multivimbroker/pub/utils/values.py
index a5b5e3a..440ad07 100644
--- a/multivimbroker/multivimbroker/pub/utils/values.py
+++ b/multivimbroker/multivimbroker/pub/utils/values.py
@@ -19,4 +19,3 @@ def ignore_case_get(args, key, def_val=""):
if old_key.upper() == key.upper():
return args[old_key]
return def_val
-
diff --git a/multivimbroker/multivimbroker/samples/tests.py b/multivimbroker/multivimbroker/samples/tests.py
index 50b571a..25850c9 100644
--- a/multivimbroker/multivimbroker/samples/tests.py
+++ b/multivimbroker/multivimbroker/samples/tests.py
@@ -24,6 +24,7 @@ class SampleViewTest(unittest.TestCase):
def test_sample(self):
response = self.client.get("/samples/")
- self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+ self.assertEqual(status.HTTP_200_OK,
+ response.status_code, response.content)
resp_data = json.loads(response.content)
self.assertEqual({"status": "active"}, resp_data)
diff --git a/multivimbroker/multivimbroker/settings.py b/multivimbroker/multivimbroker/settings.py
index 2cff49b..faea32d 100644
--- a/multivimbroker/multivimbroker/settings.py
+++ b/multivimbroker/multivimbroker/settings.py
@@ -73,7 +73,8 @@ DATABASES = {
}
}
-# CACHE_BACKEND = 'redis_cache.cache://%s@%s:%s' % (REDIS_PASSWD, REDIS_HOST, REDIS_PORT)
+# CACHE_BACKEND = 'redis_cache.cache://%s@%s:%s' %
+# (REDIS_PASSWD, REDIS_HOST, REDIS_PORT)
TIME_ZONE = 'UTC'
@@ -87,7 +88,8 @@ LOGGING = {
'disable_existing_loggers': True,
'formatters': {
'standard': {
- 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s',
+ 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] \
+ [%(levelname)s]:%(message)s',
},
},
'filters': {
@@ -96,7 +98,8 @@ LOGGING = {
'multivimbroker_handler': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
- 'filename': os.path.join(BASE_DIR, 'logs/runtime_multivimbroker.log'),
+ 'filename': os.path.join(BASE_DIR,
+ 'logs/runtime_multivimbroker.log'),
'formatter': 'standard',
'maxBytes': 1024 * 1024 * 50,
'backupCount': 5,
diff --git a/multivimbroker/multivimbroker/swagger/tests.py b/multivimbroker/multivimbroker/swagger/tests.py
index f8147ec..25634ff 100644
--- a/multivimbroker/multivimbroker/swagger/tests.py
+++ b/multivimbroker/multivimbroker/swagger/tests.py
@@ -10,7 +10,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import unittest
-import json
+# import json
from django.test import Client
from rest_framework import status
@@ -24,6 +24,7 @@ class SampleViewTest(unittest.TestCase):
def test_sample(self):
response = self.client.get("/api/multicloud/v0/swagger.json")
- self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+ self.assertEqual(status.HTTP_200_OK,
+ response.status_code, response.content)
# resp_data = json.loads(response.content)
# self.assertEqual({"status": "active"}, resp_data)
diff --git a/multivimbroker/multivimbroker/swagger/urls.py b/multivimbroker/multivimbroker/swagger/urls.py
index d1af883..ae0b4ae 100644
--- a/multivimbroker/multivimbroker/swagger/urls.py
+++ b/multivimbroker/multivimbroker/swagger/urls.py
@@ -9,10 +9,10 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
-from multivimbroker.swagger import views
+# from multivimbroker.swagger import views
from multivimbroker.swagger.views import SwaggerJsonView
urlpatterns = [
diff --git a/multivimbroker/multivimbroker/swagger/views.py b/multivimbroker/multivimbroker/swagger/views.py
index 5fcfb53..168259e 100644
--- a/multivimbroker/multivimbroker/swagger/views.py
+++ b/multivimbroker/multivimbroker/swagger/views.py
@@ -12,83 +12,93 @@
import json
import logging
import os
-import traceback
+# import traceback
-from rest_framework import status
+# from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from multivimbroker.pub.exceptions import VimBrokerException
+# from multivimbroker.pub.exceptions import VimBrokerException
logger = logging.getLogger(__name__)
class SwaggerJsonView(APIView):
def get(self, request):
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.flavor.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.flavor.swagger.json')
f = open(json_file)
json_data = json.JSONDecoder().decode(f.read())
f.close()
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.image.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.image.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.network.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.network.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.subnet.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.subnet.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.server.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.server.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.volume.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.volume.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.vport.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.vport.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.tenant.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.tenant.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.host.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.host.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.limit.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.limit.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
#
- json_file = os.path.join(os.path.dirname(__file__), 'multivim.identity.swagger.json')
+ json_file = os.path.join(os.path.dirname(__file__),
+ 'multivim.identity.swagger.json')
f = open(json_file)
json_data_temp = json.JSONDecoder().decode(f.read())
f.close()
json_data["paths"].update(json_data_temp["paths"])
json_data["definitions"].update(json_data_temp["definitions"])
return Response(json_data)
-
diff --git a/multivimbroker/tox.ini b/multivimbroker/tox.ini
index 9292301..88d43d9 100644
--- a/multivimbroker/tox.ini
+++ b/multivimbroker/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27
+envlist = py27,pep8
skipsdist = true
[tox:jenkins]
@@ -8,3 +8,7 @@ downloadcache = ~/cache/pip
[testenv]
deps = -r{toxinidir}/requirements.txt
commands = coverage run --branch manage.py test multivimbroker
+
+[testenv:pep8]
+deps=flake8
+commands=flake8