summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-22 09:27:35 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-09-22 09:27:35 +0800
commit4f52c498126d28f6d660a73f578d05c1d6d343df (patch)
tree58d475e1b674a330e2928ba2857565c5205c9b5a
parent8f0f056871ecf43fa8f10f51f61b47b5ce17eb88 (diff)
Update vfc-gvnfmadapter run.sh and stop.sh
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>
-rwxr-xr-xgvnfmadapter/docker/instance_config.sh2
-rw-r--r--gvnfmadapter/driver/interfaces/tests.py14
-rwxr-xr-xgvnfmadapter/run.sh2
-rwxr-xr-xgvnfmadapter/stop.sh2
4 files changed, 2 insertions, 18 deletions
diff --git a/gvnfmadapter/docker/instance_config.sh b/gvnfmadapter/docker/instance_config.sh
index e025386..e69f6d0 100755
--- a/gvnfmadapter/docker/instance_config.sh
+++ b/gvnfmadapter/docker/instance_config.sh
@@ -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
diff --git a/gvnfmadapter/driver/interfaces/tests.py b/gvnfmadapter/driver/interfaces/tests.py
index aebc5e3..4874354 100644
--- a/gvnfmadapter/driver/interfaces/tests.py
+++ b/gvnfmadapter/driver/interfaces/tests.py
@@ -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"}}
diff --git a/gvnfmadapter/run.sh b/gvnfmadapter/run.sh
index 7600abb..b107ce3 100755
--- a/gvnfmadapter/run.sh
+++ b/gvnfmadapter/run.sh
@@ -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 &
diff --git a/gvnfmadapter/stop.sh b/gvnfmadapter/stop.sh
index 26efe30..cf34a42 100755
--- a/gvnfmadapter/stop.sh
+++ b/gvnfmadapter/stop.sh
@@ -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