You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2015/05/20 17:09:48 UTC

[2/2] stratos git commit: add mock iaas to stratos installer

add mock iaas to stratos installer


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/9a9d6a79
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/9a9d6a79
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/9a9d6a79

Branch: refs/heads/master
Commit: 9a9d6a79a26a409a665bcae1ced8da0f943374c3
Parents: 3b03ba9
Author: Udara Liyanage <ud...@wso2.com>
Authored: Wed May 20 20:37:22 2015 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Wed May 20 20:39:31 2015 +0530

----------------------------------------------------------------------
 tools/stratos-installer/conf/setup.conf         |  3 +
 tools/stratos-installer/mock_iaas.sh            | 62 ++++++++++++++++++++
 tools/stratos-installer/setup.sh                |  2 +
 .../templates/cloud-controller.xml              |  7 +++
 4 files changed, 74 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/9a9d6a79/tools/stratos-installer/conf/setup.conf
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/conf/setup.conf b/tools/stratos-installer/conf/setup.conf
index be2c867..552e681 100644
--- a/tools/stratos-installer/conf/setup.conf
+++ b/tools/stratos-installer/conf/setup.conf
@@ -106,6 +106,9 @@ export kubernetes_provider_enabled=false
 export kubernetes_identity="<kubernetes_identity>"
 export kubernetes_credential="<kubernetes_credential>"
 
+# Mock
+export mock_iaas_enabled=false
+
 # Database configuration
 # ----------------------------------------------------------------------------
 export mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar" #mysql connector jar file name

http://git-wip-us.apache.org/repos/asf/stratos/blob/9a9d6a79/tools/stratos-installer/mock_iaas.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/mock_iaas.sh b/tools/stratos-installer/mock_iaas.sh
new file mode 100755
index 0000000..de688e1
--- /dev/null
+++ b/tools/stratos-installer/mock_iaas.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# ----------------------------------------------------------------------------
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+# ----------------------------------------------------------------------------
+#
+#  This script is invoked by setup.sh for configuring OpenStack IaaS information.
+# ----------------------------------------------------------------------------
+
+# Die on any error:
+set -e
+
+# General commands
+if [ "$(uname)" == "Darwin" ]; then
+    # Do something under Mac OS X platform  
+	SED=`which gsed` && : || (echo "Command 'gsed' is not installed."; exit 10;)
+else
+    # Do something else under some other platform
+    SED=`which sed` && : || (echo "Command 'sed' is not installed."; exit 10;)
+fi
+
+SLEEP=60
+export LOG=$log_path/stratos-openstack.log
+
+source "./conf/setup.conf"
+
+stratos_extract_path=$1
+mock_iaas_enabled=$2
+
+if [[ ! -d $log_path ]]; then
+    mkdir -p $log_path
+fi
+
+pushd $stratos_extract_path
+
+echo "Set Mock IaaS provider specific info in repository/conf/cloud-controller.xml" >> $LOG
+
+if [[ $mock_iaas_enabled = true ]]; then
+	${SED} -i "s@MOCK_IAAS_PROVIDER_START@@g" repository/conf/cloud-controller.xml
+	${SED} -i "s@MOCK_IAAS_PROVIDER_END@@g"  repository/conf/cloud-controller.xml
+else
+	${SED} -i "s@MOCK_IAAS_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
+	${SED} -i "s@MOCK_IAAS_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
+fi
+
+popd

http://git-wip-us.apache.org/repos/asf/stratos/blob/9a9d6a79/tools/stratos-installer/setup.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/setup.sh b/tools/stratos-installer/setup.sh
index 6a764ec..456c532 100755
--- a/tools/stratos-installer/setup.sh
+++ b/tools/stratos-installer/setup.sh
@@ -253,6 +253,8 @@ function cc_setup() {
         ./kubernetes.sh $stratos_extract_path
     fi
 
+    ./mock_iaas.sh $stratos_extract_path $mock_iaas_enabled
+
     pushd $stratos_extract_path
     
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/9a9d6a79/tools/stratos-installer/templates/cloud-controller.xml
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/templates/cloud-controller.xml b/tools/stratos-installer/templates/cloud-controller.xml
index b4548e0..72a05e1 100644
--- a/tools/stratos-installer/templates/cloud-controller.xml
+++ b/tools/stratos-installer/templates/cloud-controller.xml
@@ -100,5 +100,12 @@
                     <identity svns:secretAlias="cloud.controller.kubernetes.identity">identity</identity>
                     <credential svns:secretAlias="cloud.controller.kubernetes.credential">credential</credential>
                 </iaasProviderKUBERNETES_PROVIDER_END>
+	        <MOCK_IAAS_PROVIDER_STARTiaasProvider type="mock" name="Mock">
+		    <className>org.apache.stratos.cloud.controller.iaases.mock.MockIaas</className>
+		    <provider>mock</provider>
+		    <identity svns:secretAlias="cloud.controller.mock.identity">identity</identity>
+		    <credential svns:secretAlias="cloud.controller.mock.credential">credential</credential>
+		    <property name="api.endpoint" value="https://localhost:9443/mock-iaas/api" />
+		</iaasProviderMOCK_IAAS_PROVIDER_END>
         </iaasProviders>
 </cloudController>