Update vfc-gvnfmadapter run.sh and stop.sh 93/14393/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Fri, 22 Sep 2017 01:27:35 +0000 (09:27 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Fri, 22 Sep 2017 01:27:35 +0000 (09:27 +0800)
Listen to all native addresses when you start the Django service,
so that you can accept rest requests for all local addresses.
And remove docker invalid address substitution.

Change-Id: Ia34a5b821b66886a4bbbc446cb3040c199299fc2
Issue-ID: VFC-414
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
gvnfmadapter/docker/instance_config.sh
gvnfmadapter/driver/interfaces/tests.py
gvnfmadapter/run.sh
gvnfmadapter/stop.sh

index e025386..e69f6d0 100755 (executable)
@@ -13,8 +13,6 @@ fi
 
 if [ $SERVICE_IP ]; then
     sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py
-    sed -i "s|127\.0\.0\.1|$SERVICE_IP|" vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/run.sh
-    sed -i "s|127\.0\.0\.1|$SERVICE_IP|" vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/stop.sh
 fi
 
 cat vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py
index aebc5e3..4874354 100644 (file)
@@ -27,7 +27,6 @@ class InterfacesTest(TestCase):
     def tearDown(self):
         pass
 
-    # @mock.patch.object(restcall, 'call_req_aai')
     @mock.patch.object(restcall, 'call_req')
     def test_instantiate_vnf(self, mock_call_req):
         vnfm_info = {
@@ -56,7 +55,6 @@ class InterfacesTest(TestCase):
         r1 = [0, json.JSONEncoder().encode(vnfm_info), "200"]
         ret = [0, json.JSONEncoder().encode(job_info), '200']
         ret2 = [0, json.JSONEncoder().encode(vnflcm_info), '200']
-        # mock_call_req_aai.side_effect = [r1, r1]
         mock_call_req.side_effect = [r1, ret, r1, ret2]
         req_data = {
             'vnfInstanceName': 'VFW_f88c0cb7-512a-44c4-bd09-891663f19367',
@@ -81,8 +79,6 @@ class InterfacesTest(TestCase):
         print response.data
         self.assertEqual(job_info, response.data)
 
-
-    # @mock.patch.object(restcall, 'call_req_aai')
     @mock.patch.object(restcall, 'call_req')
     def test_terminate_vnf(self, mock_call_req):
         vnfm_info = {
@@ -104,14 +100,11 @@ class InterfacesTest(TestCase):
         r1 = [0, json.JSONEncoder().encode(vnfm_info), "200"]
         r2 = [0, json.JSONEncoder().encode(job_info), "200"]
         job_ret = [0,  json.JSONEncoder().encode(job_status_info), "200"]
-        # mock_call_req_aai.side_effect = [r1, r1, r1]
         mock_call_req.side_effect = [r1, r2, r1, job_ret, r1, r2]
         response = self.client.post("/api/gvnfmdriver/v1/ztevnfmid/vnfs/2/terminate")
         self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code)
         self.assertEqual(job_info, response.data)
 
-
-    # @mock.patch.object(restcall, 'call_req_aai')
     @mock.patch.object(restcall, 'call_req')
     def test_query_vnf(self, mock_call_req):
         vnfm_info = {
@@ -131,15 +124,12 @@ class InterfacesTest(TestCase):
         job_info = {"ResponseInfo": {"vnfInstanceId":"88","instantiationState":"INSTANTIATED","vnfSoftwareVersion":"v1.2.3"}}
         r1 = [0, json.JSONEncoder().encode(vnfm_info), "200"]
         r2 = [0, json.JSONEncoder().encode(job_info), "200"]
-        # mock_call_req_aai.side_effect = [r1]
         mock_call_req.side_effect = [r1, r2]
         response = self.client.get("/api/gvnfmdriver/v1/19ecbb3a-3242-4fa3-9926-8dfb7ddc29ee/vnfs/88")
         self.assertEqual(status.HTTP_200_OK, response.status_code)
         expect_resp_data = {"vnfInfo": {"vnfInstanceId": "88", "vnfStatus": "ACTIVE","version":"v1.2.3"}}
         self.assertEqual(expect_resp_data, response.data)
 
-
-    # @mock.patch.object(restcall, 'call_req_aai')
     @mock.patch.object(restcall, 'call_req')
     def test_operation_status(self, mock_call_req):
         vnfm_info = {
@@ -195,17 +185,13 @@ class InterfacesTest(TestCase):
         }
         r1 = [0, json.JSONEncoder().encode(vnfm_info), '200']
         r2 = [0, json.JSONEncoder().encode(resp_body), '200']
-        # mock_call_req_aai.side_effect = [r1]
         mock_call_req.side_effect = [r1, r2]
         response = self.client.get("/api/gvnfmdriver/v1/{vnfmid}/jobs/{jobid}?responseId={responseId}".
             format(vnfmid=vnfm_info["vnfmId"],jobid=resp_body["ResponseInfo"]["vnfLcOpId"],
                    responseId=resp_body["ResponseInfo"]["responseDescriptor"]["responseId"]))
         self.assertEqual(status.HTTP_200_OK, response.status_code)
-        print "========"
-        print response.data
         self.assertDictEqual(expected_body, response.data)
 
-
     @mock.patch.object(restcall, 'call_req')
     def test_grantvnf(self, mock_call_req):
         vim_info = {"vim":{"accessinfo":{"tenant":"admin"},"vimid":"516cee95-e8ca-4d26-9268-38e343c2e31e"}}
index 7600abb..b107ce3 100755 (executable)
@@ -12,4 +12,4 @@
 # 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.
-nohup python manage.py runserver 127.0.0.1:8484 > /dev/null &
+nohup python manage.py runserver 0.0.0.0:8484 > /dev/null &
index 26efe30..cf34a42 100755 (executable)
@@ -12,4 +12,4 @@
 # 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.
-ps auxww | grep 'manage.py runserver 127.0.0.1:8484' | awk '{print $2}' | xargs kill -9
+ps auxww | grep 'manage.py runserver 0.0.0.0:8484' | awk '{print $2}' | xargs kill -9