Implementation of HTTPS support for VFC-gvnfm project interface 42/109442/4
authordengyh <dengyuanhong@chinamobile.com>
Tue, 23 Jun 2020 08:29:30 +0000 (16:29 +0800)
committerYuanhong Deng <dengyuanhong@chinamobile.com>
Sun, 28 Jun 2020 04:26:00 +0000 (04:26 +0000)
Change-Id: Ib85dafe3c1fe8d4abd574bd8aa5f7119338cf7ae
Issue-ID: VFC-1676
Signed-off-by: dengyh <dengyuanhong@chinamobile.com>
gvnfmadapter/docker/instance_config.sh
gvnfmadapter/driver/pub/config/config.py
gvnfmadapter/requirements.txt
gvnfmadapter/run.sh
gvnfmadapter/stop.sh

index 8fa1249..2f45eee 100755 (executable)
@@ -24,4 +24,8 @@ if [ $SERVICE_IP ]; then
     sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py
 fi
 
+if [ $SSL_ENABLED ]; then
+    sed -i "s|SSL_ENABLED = .*|SSL_ENABLED = '$SSL_ENABLED'|"  vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py
+fi
+
 cat vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py
index 4c01ded..44fc5ce 100644 (file)
@@ -25,10 +25,16 @@ FORWARDED_FOR_FIELDS = ["HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED_HOST",
 
 # [register]
 REG_TO_MSB_WHEN_START = True
+SSL_ENABLED = "true"
 REG_TO_MSB_REG_URL = "/api/microservices/v1/services"
+if SSL_ENABLED == "true":
+    enable_ssl = "true"
+else:
+    enable_ssl = "false"
 REG_TO_MSB_REG_PARAM = {
     "serviceName": "gvnfmdriver",
     "version": "v1",
+    "enable_ssl": enable_ssl,
     "url": "/api/gvnfmdriver/v1",
     "protocol": "REST",
     "visualRange": "1",
index 506a6fa..45c2cfd 100644 (file)
@@ -22,4 +22,4 @@ swagger-spec-validator>=2.1.0
 onappylog>=1.0.9
 
 # uwsgi for parallel processing
-uwsgi
+uwsgi
index 69063fd..9063114 100755 (executable)
@@ -18,10 +18,10 @@ if [ ! -x  $logDir  ]; then
        mkdir -p $logDir
 fi
 
-nohup python manage.py runserver 0.0.0.0:8484 > /dev/null &
+nohup python manage.py runserver 0.0.0.0:8484 > /dev/null &
 
-if [ "${SSL_ENABLED}" = "true" ]; then
-#     nohup uwsgi --https :8484,driver/pub/ssl/cert/foobar.crt,driver/pub/ssl/cert/foobar.key, -t 120 --module driver.wsgi --master --processes 4 &
-else
-#     nohup uwsgi --http :8484 -t 120 --module driver.wsgi --master --processes 4 &
-fi
+if [ "${SSL_ENABLED}" = "true" ]; then
+   nohup uwsgi --https :8484,driver/pub/ssl/cert/foobar.crt,driver/pub/ssl/cert/foobar.key, -t 120 --module driver.wsgi --master --processes 4 &
+else
+   nohup uwsgi --http :8484 -t 120 --module driver.wsgi --master --processes 4 &
+fi
index abfb4f5..1e86dde 100755 (executable)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-ps auxww | grep 'manage.py runserver 0.0.0.0:8484' | awk '{print $1}' | xargs kill -9
+ps auxww | grep 'manage.py runserver 0.0.0.0:8484' | awk '{print $1}' | xargs kill -9
 # ps auxww |grep 'uwsgi --http' |awk '{print $1}' |xargs kill -9
+
+if [ "${SSL_ENABLED}" = "true" ]; then
+    ps auxww |grep 'uwsgi --https :8484' |awk '{print $1}' |xargs kill -9
+else
+    ps auxww |grep 'uwsgi --http :8484' |awk '{print $1}' |xargs kill -9
+fi
\ No newline at end of file