summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinhuili <lxinhui@vmware.com>2017-09-21 07:15:08 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-21 07:15:08 +0000
commit73335f2c7e12d226b8b181bdb420dab5717cad5d (patch)
treeee27e95e69b6522d78958bcc635deba16841c48a
parent88f24efabca0667fe9fae2b7537044345dac2f79 (diff)
parent0d081b4743d113be79edf5a1c0ce1078477619e3 (diff)
Merge "Fix multicloud vio bugs"
-rwxr-xr-xvio/docker/instance-config.sh2
-rwxr-xr-xvio/stop.sh2
-rw-r--r--vio/vio/pub/msapi/extsys.py6
-rw-r--r--vio/vio/swagger/views/proxyplugin/httpclient.py7
-rw-r--r--vio/vio/swagger/views/proxyplugin/identity/views.py21
5 files changed, 29 insertions, 9 deletions
diff --git a/vio/docker/instance-config.sh b/vio/docker/instance-config.sh
index 221cac9..cb05a9a 100755
--- a/vio/docker/instance-config.sh
+++ b/vio/docker/instance-config.sh
@@ -2,7 +2,7 @@
# Configure MSB IP address
MSB_IP=`echo $MSB_ADDR | cut -d: -f 1`
-MSB_PORT=`echo $MSB_ADDR | cut -d: -f 2`
+MSB_PORT=`echo $MSB_PORT | cut -d: -f 2`
sed -i "s|MSB_SERVICE_IP.*|MSB_SERVICE_IP = '$MSB_IP'|" vio/vio/pub/config/config.py
sed -i "s|MSB_SERVICE_PORT.*|MSB_SERVICE_PORT = '$MSB_PORT'|" vio/vio/pub/config/config.py
sed -i "s|DB_NAME.*|DB_NAME = 'inventory'|" vio/vio/pub/config/config.py
diff --git a/vio/stop.sh b/vio/stop.sh
index 0196606..1d35d39 100755
--- a/vio/stop.sh
+++ b/vio/stop.sh
@@ -11,4 +11,4 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-ps auxww | grep 'manage.py runserver 127.0.0.1:9004' | awk '{print $2}' | xargs kill -9
+ps auxww | grep 'manage.py runserver 0.0.0.0:9004' | awk '{print $2}' | xargs kill -9
diff --git a/vio/vio/pub/msapi/extsys.py b/vio/vio/pub/msapi/extsys.py
index b3ed044..c3d87d1 100644
--- a/vio/vio/pub/msapi/extsys.py
+++ b/vio/vio/pub/msapi/extsys.py
@@ -33,7 +33,7 @@ def get_vim_by_id(vim_id):
ret['vimId'] = vim_id
ret['name'] = vim_id
ret['userName'] = ret['esr-system-info-list'][
- 'esr-system-info'][0]['username']
+ 'esr-system-info'][0]['user-name']
ret['password'] = ret['esr-system-info-list'][
'esr-system-info'][0]['password']
ret['tenant'] = ret['esr-system-info-list'][
@@ -43,7 +43,7 @@ def get_vim_by_id(vim_id):
ret['domain'] = ret['esr-system-info-list'][
'esr-system-info'][0]['cloud-domain']
ret['cacert'] = ret['esr-system-info-list'][
- 'esr-system-info'][0]['ssl-cacert']
+ 'esr-system-info'][0].get('ssl-cacert', "")
ret['insecure'] = ret['esr-system-info-list'][
- 'esr-system-info'][0]['ssl-insecure']
+ 'esr-system-info'][0].get('ssl-insecure', False)
return ret
diff --git a/vio/vio/swagger/views/proxyplugin/httpclient.py b/vio/vio/swagger/views/proxyplugin/httpclient.py
index f1cfbb1..bf1bc17 100644
--- a/vio/vio/swagger/views/proxyplugin/httpclient.py
+++ b/vio/vio/swagger/views/proxyplugin/httpclient.py
@@ -69,14 +69,15 @@ class BaseClient(APIView):
def buildRequest(self, request, vimid, tenantid="", tail=None):
+ headers = {}
preUrl = catalog.getEndpointBy(
vimid, serverType=self.serverType, interface="public")
token = request.META.get('HTTP_X_AUTH_TOKEN', "")
tail = "/" + tail if tail else ""
tenantid = "/" + tenantid if tenantid else ""
endPointURL = preUrl + tenantid + tail
-
- headers = {"X-Auth-Token": token}
+ headers["X-Auth-Token"] = token
+ headers["X-Subject-Token"] = token
headers['Content-Type'] = request.META.get(
"CONTENT_TYPE", "application/json")
try:
@@ -84,7 +85,7 @@ class BaseClient(APIView):
except Exception:
json_req = ""
- return (endPointURL, headers, json_req)
+ return endPointURL, headers, json_req
def _request(self, url, method, redirect=20,
connect_retries=0, connect_retry_delay=0.5, **kwargs):
diff --git a/vio/vio/swagger/views/proxyplugin/identity/views.py b/vio/vio/swagger/views/proxyplugin/identity/views.py
index cee11e7..56ac864 100644
--- a/vio/vio/swagger/views/proxyplugin/identity/views.py
+++ b/vio/vio/swagger/views/proxyplugin/identity/views.py
@@ -46,7 +46,26 @@ class IdentityServer(BaseClient):
if query != "":
query = query[:-1]
url += "/?" + query
- return self._request(url, method="GET", headers=headers)
+
+ try:
+ res = self._request(url, method="GET", headers=headers)
+ if res.status_code != status.HTTP_200_OK:
+ return Response(data={"error": res.content},
+ status=res.status_code)
+ res = res.data
+ # replace keystone auth url with multicloud
+ # identity url
+ if other is None:
+ res['version']['links'][0]['href'] = \
+ "http://" + MSB_ADDRESS + "/multicloud-vio/v0/" \
+ + vimid + "/identity"
+
+ except Exception as e:
+ logging.exception("error %s" % e)
+ return Response(data={"error": str(e)},
+ status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+
+ return Response(data=res, status=status.HTTP_200_OK)
def patch(self, request, vimid, other):