From 7c9d941a80634d40d03f38c3f24ea503822d4b79 Mon Sep 17 00:00:00 2001 From: "victor.gao" Date: Mon, 3 Jul 2017 11:44:26 +0800 Subject: Change: add OPEN-O seed code for VF-C Change-Id: Iecacac039e86db2eae006c8947d6dd681e458b83 Signed-off-by: victor.gao --- .../mocoserver/VnfmAdapterSuccessServer.java | 103 +++++++++++++ .../openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java | 61 ++++++++ .../nfvo/vnfmadapter/test/ITAuthRoaSuccess.java | 60 ++++++++ .../test/ITVnfAdapterResourceRoaFail.java | 61 ++++++++ .../test/ITVnfAdapterResourceRoaSuccess.java | 60 ++++++++ .../vnfmadapter/test/ITVnfResourceRoaFail.java | 61 ++++++++ .../vnfmadapter/test/ITVnfResourceRoaSuccess.java | 60 ++++++++ .../openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java | 68 +++++++++ .../nfvo/vnfmadapter/test/ITVnfRoaSuccess.java | 69 +++++++++ .../nfvo/vnfmadapter/util/AddSuccessChecker.java | 49 +++++++ .../nfvo/vnfmadapter/util/FailureChecker.java | 44 ++++++ .../nfvo/vnfmadapter/util/GetSuccessChecker.java | 53 +++++++ .../org/openo/nfvo/vnfmadapter/util/MyChecker.java | 65 ++++++++ .../openo/nfvo/vnfmadapter/util/MyTestManager.java | 163 +++++++++++++++++++++ .../nfvo/vnfmadapter/util/SuccessChecker.java | 46 ++++++ .../integration-test/resources/server.properties | 14 ++ .../src/integration-test/resources/urlconfig.json | 18 +++ .../vnfmadapter/mocoserver/addauthinfo.json | 36 +++++ .../vnfmadapter/mocoserver/getallcloudinfo.json | 18 +++ .../vnfmadapter/mocoserver/getauthinfo.json | 36 +++++ .../vnfmadapter/mocoserver/getcsarinfo.json | 32 ++++ .../resources/vnfmadapter/mocoserver/getjob.json | 16 ++ .../resources/vnfmadapter/mocoserver/getvnf.json | 16 ++ .../vnfmadapter/mocoserver/getvnfdplaninfo.json | 29 ++++ .../vnfmadapter/mocoserver/getvnfdversion.json | 29 ++++ .../vnfmadapter/mocoserver/getvnfminfo.json | 29 ++++ .../vnfmadapter/mocoserver/grantvnfresource.json | 31 ++++ .../vnfmadapter/mocoserver/removevnf.json | 16 ++ .../vnfmadapter/mocoserver/uploadvnfpackage.json | 29 ++++ .../testcase/authroa/addauthinfofail.json | 28 ++++ .../testcase/authroa/addauthinfosuccess.json | 36 +++++ .../querygetallcloudinfofail.json | 15 ++ .../querygetallcloudinfosuccess.json | 17 +++ .../vnfresourceroa/grantvnfresourcefail.json | 39 +++++ .../vnfresourceroa/grantvnfresourcesuccess.json | 41 ++++++ .../vnfmadapter/testcase/vnfroa/addvnffail.json | 45 ++++++ .../vnfmadapter/testcase/vnfroa/addvnfsuccess.json | 44 ++++++ .../vnfmadapter/testcase/vnfroa/deletevnffail.json | 18 +++ .../testcase/vnfroa/deletevnfsuccess.json | 18 +++ .../vnfmadapter/testcase/vnfroa/getjobfail.json | 33 +++++ .../vnfmadapter/testcase/vnfroa/getjobsuccess.json | 33 +++++ .../vnfmadapter/testcase/vnfroa/getvnffail.json | 33 +++++ .../vnfmadapter/testcase/vnfroa/getvnfsuccess.json | 33 +++++ 43 files changed, 1805 insertions(+) create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/server.properties create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/urlconfig.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getjob.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfofail.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfosuccess.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfofail.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfosuccess.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcefail.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcesuccess.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnffail.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnfsuccess.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnffail.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnfsuccess.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobfail.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobsuccess.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnffail.json create mode 100644 huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnfsuccess.json (limited to 'huawei/vnfmadapter/VnfmadapterService/service/src/integration-test') diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java new file mode 100644 index 00000000..8554f7ae --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016, Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.mocoserver; + +import org.openo.sdno.testframework.http.model.HttpRequest; +import org.openo.sdno.testframework.http.model.HttpResponse; +import org.openo.sdno.testframework.http.model.HttpRquestResponse; +import org.openo.sdno.testframework.moco.MocoHttpServer; +import org.openo.sdno.testframework.moco.responsehandler.MocoResponseHandler; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Aug 2, 2016 + */ +public class VnfmAdapterSuccessServer extends MocoHttpServer { + + private static final String GET_ALL_CLOUD_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json"; + + private static final String ADD_AUTH_INFO_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json"; + + private static final String GRANT_VNF_RES_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json"; + + private static final String GET_CSAR_INFO_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json"; + + private static final String GET_VNFM_INFO_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json"; + + private static final String UPLOAD_VNF_INFO_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json"; + + private static final String GET_VNFD_VER_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json"; + + private static final String GET_VNFD_PLAN_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json"; + + private static final String REMOVE_VNF_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json"; + + private static final String GET_VNF_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json"; + + private static final String GET_AUTH_INFO_FILE = + "src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json"; + + public VnfmAdapterSuccessServer() { + super(); + } + + public VnfmAdapterSuccessServer(int port) { + super(port); + } + + @Override + public void addRequestResponsePairs() { + this.addRequestResponsePair(GET_ALL_CLOUD_FILE); + this.addRequestResponsePair(ADD_AUTH_INFO_FILE); + this.addRequestResponsePair(GRANT_VNF_RES_FILE); + this.addRequestResponsePair(GET_CSAR_INFO_FILE); + this.addRequestResponsePair(GET_VNFM_INFO_FILE); + this.addRequestResponsePair(UPLOAD_VNF_INFO_FILE); + this.addRequestResponsePair(GET_VNFD_VER_FILE); + this.addRequestResponsePair(GET_VNFD_PLAN_FILE); + this.addRequestResponsePair(REMOVE_VNF_FILE); + this.addRequestResponsePair(GET_VNF_FILE); + this.addRequestResponsePair(GET_AUTH_INFO_FILE); + } + + private class CreateVimResponseHandler extends MocoResponseHandler { + + @Override + public void processRequestandResponse(HttpRquestResponse httpObject) { + System.out.println("***********************"); + System.out.println(httpObject); + System.out.println("***********************"); + HttpRequest httpRequest = httpObject.getRequest(); + HttpResponse httpResponse = httpObject.getResponse(); + } + } + +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java new file mode 100644 index 00000000..14469b29 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java @@ -0,0 +1,61 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.AddSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.FailureChecker; +import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 20, 2016 + */ +public class ITAuthRoaFail extends MyTestManager { + + private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfofail.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*30); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess1() throws ServiceException { + execTestCase(new File(POST_PATH),new FailureChecker()); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java new file mode 100644 index 00000000..0393571e --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java @@ -0,0 +1,60 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.AddSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 20, 2016 + */ +public class ITAuthRoaSuccess extends MyTestManager { + + private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfosuccess.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*30); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess1() throws ServiceException { + execTestCase(new File(POST_PATH)); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java new file mode 100644 index 00000000..8ef66b03 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java @@ -0,0 +1,61 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.FailureChecker; +import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; +import org.openo.nfvo.vnfmadapter.util.SuccessChecker; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 24, 2016 + */ +public class ITVnfAdapterResourceRoaFail extends MyTestManager { + + private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfofail.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(31943); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*30); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess() throws ServiceException { + execTestCase(new File(GET_PATH),new FailureChecker()); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java new file mode 100644 index 00000000..64ad1275 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java @@ -0,0 +1,60 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; +import org.openo.nfvo.vnfmadapter.util.SuccessChecker; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 24, 2016 + */ +public class ITVnfAdapterResourceRoaSuccess extends MyTestManager { + + private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfosuccess.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(31943); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*30); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess() throws ServiceException { + execTestCase(new File(GET_PATH),new GetSuccessChecker()); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java new file mode 100644 index 00000000..25aeaa67 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java @@ -0,0 +1,61 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.FailureChecker; +import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; +import org.openo.nfvo.vnfmadapter.util.SuccessChecker; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 24, 2016 + */ +public class ITVnfResourceRoaFail extends MyTestManager { + + private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcefail.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*60); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess() throws ServiceException { + execTestCase(new File(GET_PATH),new FailureChecker()); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java new file mode 100644 index 00000000..549ae1ca --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java @@ -0,0 +1,60 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; +import org.openo.nfvo.vnfmadapter.util.SuccessChecker; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 24, 2016 + */ +public class ITVnfResourceRoaSuccess extends MyTestManager { + + private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcesuccess.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*60); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess() throws ServiceException { + execTestCase(new File(GET_PATH),new GetSuccessChecker()); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java new file mode 100644 index 00000000..784aa9df --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java @@ -0,0 +1,68 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.FailureChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 24, 2016 + */ +public class ITVnfRoaFail extends MyTestManager { + + private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnffail.json"; + + private static final String DEL_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnffail.json"; + + private static final String GET_VNF_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnffail.json"; + + private static final String GET_JOB_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobfail.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*30); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess() throws ServiceException { + execTestCase(new File(GET_VNF_PATH),new FailureChecker()); + execTestCase(new File(POST_PATH),new FailureChecker()); + execTestCase(new File(GET_JOB_PATH),new FailureChecker()); + execTestCase(new File(DEL_PATH),new FailureChecker()); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java new file mode 100644 index 00000000..b2109e1f --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java @@ -0,0 +1,69 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.test; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer; +import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker; +import org.openo.nfvo.vnfmadapter.util.MyTestManager; +import org.openo.nfvo.vnfmadapter.util.SuccessChecker; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 24, 2016 + */ +public class ITVnfRoaSuccess extends MyTestManager { + + private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnfsuccess.json"; + + private static final String DEL_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnfsuccess.json"; + + private static final String GET_VNF_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnfsuccess.json"; + + private static final String GET_JOB_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobsuccess.json"; + + private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(); + + + @Before + public void setup() throws ServiceException, InterruptedException { + vnfmAdapterServer.start(); +// Thread.sleep(1000*60); + } + + @After + public void tearDown() throws ServiceException { + vnfmAdapterServer.stop(); + } + + @Test + public void testOperateSuccess() throws ServiceException { + execTestCase(new File(GET_VNF_PATH),new GetSuccessChecker()); +// execTestCase(new File(POST_PATH),new GetSuccessChecker()); + execTestCase(new File(GET_JOB_PATH),new GetSuccessChecker()); + execTestCase(new File(DEL_PATH),new GetSuccessChecker()); + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java new file mode 100644 index 00000000..ea0dc396 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java @@ -0,0 +1,49 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.util; + +import org.openo.sdno.testframework.checker.IChecker; +import org.openo.sdno.testframework.http.model.HttpResponse; + +import net.sf.json.JSONObject; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 21, 2016 + */ +public class AddSuccessChecker implements IChecker { + + String addMsg = "org.openo.nfvo.resmanage.common.update.success"; + + @Override + public boolean check(HttpResponse response) { + System.out.println("===================="); + System.out.println(response); + String data = response.getData(); + System.out.println("********************"); + System.out.println(data); +// JSONObject dataObj = JSONObject.fromObject(data); + if(response.getStatus() == 201 && data != null && !data.isEmpty()) { + return true; + } + return false; + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java new file mode 100644 index 00000000..f1b8f248 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016, Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.util; + +import org.openo.sdno.testframework.checker.IChecker; +import org.openo.sdno.testframework.http.model.HttpResponse; + +import net.sf.json.JSONObject; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Aug 16, 2016 + */ +public class FailureChecker implements IChecker { + + @Override + public boolean check(HttpResponse response) { + String data = response.getData(); + if(response.getStatus() != 200) { + return true; + } + JSONObject dataObj = JSONObject.fromObject(data); + int retCode = (int)dataObj.get("retCode"); + return retCode == -1; + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java new file mode 100644 index 00000000..37856822 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java @@ -0,0 +1,53 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.util; + +import org.openo.sdno.testframework.checker.IChecker; +import org.openo.sdno.testframework.http.model.HttpResponse; + +import net.sf.json.JSONObject; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 21, 2016 + */ +public class GetSuccessChecker implements IChecker { + + String addMsg = "org.openo.nfvo.resmanage.common.add.success"; + + @Override + public boolean check(HttpResponse response) { + System.out.println("===================="); + System.out.println(response); + String data = response.getData(); + System.out.println("********************"); + System.out.println(data); +// JSONObject dataObj = JSONObject.fromObject(data); +// if(response.getStatus() == 200 && !dataObj.isEmpty()) { +// System.out.println(dataObj.isEmpty()); +// return true; +// } + if(response.getStatus() == 200 && data != null && !data.isEmpty()) { + return true; + } + return false; + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java new file mode 100644 index 00000000..6ff60919 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java @@ -0,0 +1,65 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.util; + +import org.openo.sdno.testframework.checker.DefaultChecker; +import org.openo.sdno.testframework.http.model.HttpResponse; + +import net.sf.json.JSONObject; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 21, 2016 + */ +public class MyChecker extends DefaultChecker { + + private HttpResponse expectedResponse; + + /** + * Constructor
+ *

+ *

+ * + * @param expectedResponse + * @since NFVO 0.5 + */ + public MyChecker(HttpResponse expectedResponse) { + super(expectedResponse); + this.expectedResponse = expectedResponse; + } + + /** + *
+ * + * @param response + * @return + * @since NFVO 0.5 + */ + @Override + public boolean check(HttpResponse response) { + System.out.println("expectedResponse:"); + System.out.println(expectedResponse.getData()); + System.out.println("response:"); + System.out.println(JSONObject.fromObject(response.getData())); + return (JSONObject.fromObject(expectedResponse.getData())).equals(JSONObject.fromObject(response.getData())); + } + +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java new file mode 100644 index 00000000..aa866bb3 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java @@ -0,0 +1,163 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.util; + +import java.io.File; +import java.util.Iterator; +import java.util.Map; + +import org.junit.Assert; +import org.openo.baseservice.remoteservice.exception.ServiceException; +import org.openo.baseservice.roa.util.restclient.RestfulParametes; +import org.openo.baseservice.roa.util.restclient.RestfulResponse; +import org.openo.sdno.testframework.checker.DefaultChecker; +import org.openo.sdno.testframework.http.model.HttpModelUtils; +import org.openo.sdno.testframework.http.model.HttpRequest; +import org.openo.sdno.testframework.http.model.HttpResponse; +import org.openo.sdno.testframework.http.model.HttpRquestResponse; +import org.openo.sdno.testframework.restclient.HttpRestClient; +import org.openo.sdno.testframework.testmanager.TestManager; +import org.openo.sdno.testframework.util.file.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Sep 21, 2016 + */ +public class MyTestManager extends TestManager { + + private HttpRestClient restClient; + + public MyTestManager() { + restClient = new HttpRestClient(); + } + + private static final Logger LOGGER = LoggerFactory.getLogger(MyTestManager.class); + + /** + *
+ * + * @param file + * @return + * @throws ServiceException + * @since NFVO 0.5 + */ + @Override + public HttpResponse execTestCase(File file) throws ServiceException { + String content = FileUtils.readFromJson(file); + HttpRquestResponse httpObject = HttpModelUtils.praseHttpRquestResponse(content); + return send(httpObject.getRequest(), httpObject.getResponse()); + } + + private HttpResponse send(HttpRequest request, HttpResponse response) { + try { + RestfulResponse responseResult = doSend(request); + DefaultChecker checker = new MyChecker(response); + HttpResponse httpResponse = HttpModelUtils.convertResponse(responseResult); + Assert.assertEquals(Boolean.valueOf(checker.check(httpResponse)), Boolean.valueOf(true)); + return httpResponse; + } catch(ServiceException e) { + LOGGER.error("call the restful interface failed.", e); + } + return null; + } + + private RestfulResponse doSend(HttpRequest request) throws ServiceException { + String url = request.getUri(); + String method = request.getMethod(); + String body = request.getData(); + RestfulParametes restfulParametes = new RestfulParametes(); + Map requestHeaders = request.getHeaders(); + if(null != requestHeaders) { + java.util.Map.Entry curEntity; + for(Iterator iterator = requestHeaders.entrySet().iterator(); iterator.hasNext(); restfulParametes + .putHttpContextHeader((String)curEntity.getKey(), (String)curEntity.getValue())) + curEntity = (java.util.Map.Entry)iterator.next(); + + } + Map paramMap = request.getQueries(); + if(null != paramMap) + restfulParametes.setParamMap(paramMap); + if(null != body) + restfulParametes.setRawData(body); + return callRestfulMotheds(url, method, restfulParametes); + } + + private RestfulResponse callRestfulMotheds(String url, String method, RestfulParametes restfulParametes) + throws ServiceException { + String s = method; + byte byte0 = -1; + switch(s.hashCode()) { + case 3446944: + if(s.equals("post")) + byte0 = 0; + break; + + case 102230: + if(s.equals("get")) + byte0 = 1; + break; + + case 111375: + if(s.equals("put")) + byte0 = 2; + break; + + case -1335458389: + if(s.equals("delete")) + byte0 = 3; + break; + + case 3198432: + if(s.equals("head")) + byte0 = 4; + break; + + case 106438728: + if(s.equals("patch")) + byte0 = 5; + break; + } + switch(byte0) { + case 0: // '\0' + return restClient.post(url, restfulParametes); + + case 1: // '\001' + return restClient.get(url, restfulParametes); + + case 2: // '\002' + return restClient.put(url, restfulParametes); + + case 3: // '\003' + return restClient.delete(url, restfulParametes); + + case 4: // '\004' + return restClient.head(url, restfulParametes); + + case 5: // '\005' + return restClient.patch(url, restfulParametes); + } + LOGGER.error("The method is unsupported."); + throw new ServiceException("The method is unsupported."); + } + +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java new file mode 100644 index 00000000..dcb40c8a --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016, Huawei Technologies Co., Ltd. + * + * Licensed 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. + */ + +package org.openo.nfvo.vnfmadapter.util; + +import org.openo.sdno.testframework.checker.IChecker; +import org.openo.sdno.testframework.http.model.HttpResponse; + +import net.sf.json.JSONObject; + +/** + *
+ *

+ *

+ * + * @author + * @version NFVO 0.5 Aug 16, 2016 + */ +public class SuccessChecker implements IChecker { + + String addMsg = "org.openo.nfvo.resmanage.common.add.success"; + + @Override + public boolean check(HttpResponse response) { + String data = response.getData(); + System.out.println(data); + JSONObject dataObj = JSONObject.fromObject(data); + if(response.getStatus() == 200 && addMsg.equals(dataObj.getString("msg"))) { + return true; + } + return false; + } +} diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/server.properties b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/server.properties new file mode 100644 index 00000000..44f3fdf6 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/server.properties @@ -0,0 +1,14 @@ + +## Integration Test Server Configuration File + +## Server IpAddress +serverip=127.0.0.1 + +## Server Port +serverport=8080 + +## Http Moco Server Port +mocohttpport=12306 + +## Https Moco Server Port +mocohttpsport=12307 \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/urlconfig.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/urlconfig.json new file mode 100644 index 00000000..9d07650e --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/urlconfig.json @@ -0,0 +1,18 @@ +[ + { + "url": "/svc/ipsec/v1", + "prefix": "/org.openo.sdno.ipsecservice" + }, + { + "url": "/v2.0/tokens", + "prefix": "" + }, + { + "url": "/v2.0/networks", + "prefix": "" + }, + { + "url": "/rest/v1/resmanage/virtualnetworks", + "prefix": "" + } +] \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json new file mode 100644 index 00000000..cd4398bd --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json @@ -0,0 +1,36 @@ +{ + "request": { + "uri": "/rest/vnfmmed/v2/auth/tokens", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "auth": { + "identity": { + "methods": ["password"], + "password": { + "user": { + "name": "admin", + "password": "User@123" + } + } + } + } + } + }, + "response": { + "status": 201, + "json": { + "token": { + "methods": ["password"], + "expires_at": "", + "user": { + "id": "admin", + "name": "admin" + }, + "roa_rand": "RoaRand" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json new file mode 100644 index 00000000..ab9d35ce --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json @@ -0,0 +1,18 @@ +{ + "request": { + "uri": "/rest/vnfm/vnfmvim/v2/computeservice/getAllCloud", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + + } + }, + "response": { + "status": 200, + "json": [{ + "dn": "NE=34603007" + }] + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json new file mode 100644 index 00000000..39a7caf7 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json @@ -0,0 +1,36 @@ +{ + "request": { + "uri": "/v2/auth/tokens", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "auth": { + "identity": { + "methods": "password", + "password": { + "user": { + "name": "admin", + "password": "User@123" + } + } + } + } + } + }, + "response": { + "status": 201, + "json": { + "token": { + "methods": ["password"], + "expires_at": "", + "user": { + "id": "admin", + "name": "admin" + }, + "roa_rand": "RoaRand" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json new file mode 100644 index 00000000..86d2650b --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json @@ -0,0 +1,32 @@ +{ + "request": { + "uri": "/openoapi/catalog/v1/csars/12345", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + + } + }, + "response": { + "status": 200, + "json": { + "csarId":"78ede6f3-66cc-46ab-b748-38a6c010d272", + "name":"NanocellGateway", + "provider":"ZTE", + "version":"V1.0", + "deletionPending":"false", + "createTime":"2016-06-29 03:33:15", + "modifyTime":"2016-06-29 09:33:15", + "size":"0.93M", + "operationalState":"Disabled", + "usageState":"InUse", + "onBoardState":"non-onBoarded", + "processState":"normal", + "format":"yml", + "downloadUri":"http://msb_ip:msb_port/files/catalog-http/NSAR/ZTE/NanocellGW/v1.0/NanocellGateway.csar", + "type":"NSAR" + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getjob.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getjob.json new file mode 100644 index 00000000..6dbc30e9 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getjob.json @@ -0,0 +1,16 @@ +{ + "request": { + "uri": "/v2/vapps/instances/12345?roarand=123456&type=status", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 200, + "json": { + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json new file mode 100644 index 00000000..6dbc30e9 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json @@ -0,0 +1,16 @@ +{ + "request": { + "uri": "/v2/vapps/instances/12345?roarand=123456&type=status", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 200, + "json": { + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json new file mode 100644 index 00000000..db1d0e0e --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json @@ -0,0 +1,29 @@ +{ + "request": { + "uri": "/v2/vapps/templates/12345/plans", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "template": { + "name": "MME", + "catalog": "huawei/epc/mme" + } + } + }, + "response": { + "status": 200, + "json": { + "template": { + "id": "000000001", + "name": "MME", + "vnfd_catalog": "huawei/epc/mme", + "description": "", + "vnfd_format": "tosca", + "vnfd_file_status": "queued", + "image_file_status": "queued" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json new file mode 100644 index 00000000..4c4ccf34 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json @@ -0,0 +1,29 @@ +{ + "request": { + "uri": "/v2/vapps/templates/12345", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "template": { + "name": "MME", + "catalog": "huawei/epc/mme" + } + } + }, + "response": { + "status": 200, + "json": { + "template": { + "id": "000000001", + "name": "MME", + "vnfd_catalog": "huawei/epc/mme", + "description": "", + "vnfd_format": "tosca", + "vnfd_file_status": "queued", + "image_file_status": "queued" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json new file mode 100644 index 00000000..c2bb60f3 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json @@ -0,0 +1,29 @@ +{ + "request": { + "uri": "/openoapi/extsys/v1/vnfms/12345", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + + } + }, + "response": { + "status": 200, + "json": { + "vnfmId":"19ecbb3a-3242-4fa3-9926-8dfb7ddc29ee", + "name":"vnfm", + "type":"Tacker", + "vimId":"", + "vendor":"ZTE", + "version":"v1.0", + "description":"vnfm", + "certificateUrl":"", + "url":"http://127.0.0.1:12306", + "userName":"admin", + "password":"admin", + "createTime":"2016-07-06 15:33:18" + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json new file mode 100644 index 00000000..0d729e2a --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json @@ -0,0 +1,31 @@ +{ + "request": { + "uri": "/rest/v1/resmanage/vappvm", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "vapp": { + "id": "", + "name": "", + "action": "", + "used": { + "vcpus": "", + "memory": "", + "disk": "" + }, + "drTotal": { + "vcpus": "0", + "memory": "0", + "disk": "0" + } + } + } + }, + "response": { + "status": 200, + "json": { + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json new file mode 100644 index 00000000..339419ca --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json @@ -0,0 +1,16 @@ +{ + "request": { + "uri": "/v2/vapps/instances/12345?roarand=123456", + "method": "delete", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 200, + "json": { + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json new file mode 100644 index 00000000..342c64db --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json @@ -0,0 +1,29 @@ +{ + "request": { + "uri": "/v2/vapps/templates", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "template": { + "name": "MME", + "catalog": "huawei/epc/mme" + } + } + }, + "response": { + "status": 201, + "json": { + "template": { + "id": "000000001", + "name": "MME", + "vnfd_catalog": "huawei/epc/mme", + "description": "", + "vnfd_format": "tosca", + "vnfd_file_status": "queued", + "image_file_status": "queued" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfofail.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfofail.json new file mode 100644 index 00000000..fa85f832 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfofail.json @@ -0,0 +1,28 @@ +{ + "request": { + "uri": "/rest/vnfmmed/v2/auth/tokens", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "auth": { + "identity": { + "methods": ["password"], + "password": { + "user": { + "name": "admin", + "password": "User@123" + } + } + } + } + } + }, + "response": { + "status": 500, + "json": { + + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfosuccess.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfosuccess.json new file mode 100644 index 00000000..cd4398bd --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfosuccess.json @@ -0,0 +1,36 @@ +{ + "request": { + "uri": "/rest/vnfmmed/v2/auth/tokens", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "auth": { + "identity": { + "methods": ["password"], + "password": { + "user": { + "name": "admin", + "password": "User@123" + } + } + } + } + } + }, + "response": { + "status": 201, + "json": { + "token": { + "methods": ["password"], + "expires_at": "", + "user": { + "id": "admin", + "name": "admin" + }, + "roa_rand": "RoaRand" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfofail.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfofail.json new file mode 100644 index 00000000..c38949c8 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfofail.json @@ -0,0 +1,15 @@ +{ + "request": { + "uri": "/rest/rest/vnfm/vnfmvim/v2/computeservice/getAllCloud", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + } + }, + "response": { + "status": 404, + "json": { + + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfosuccess.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfosuccess.json new file mode 100644 index 00000000..33beb0ca --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfosuccess.json @@ -0,0 +1,17 @@ +{ + "request": { + "uri": "/rest/rest/vnfm/vnfmvim/v2/computeservice/getAllCloud", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + } + }, + "response": { + "status": 200, + "json": [ + { + "dn": "NE=34603007" + } + ] + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcefail.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcefail.json new file mode 100644 index 00000000..bc17edea --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcefail.json @@ -0,0 +1,39 @@ +{ + "request": { + "uri": "/rest/vnfmmed/csm/v2/vapps/instances/123456/grant", + "method": "put", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "grant": { + "vnf_id":"", + "project_id": "", + "type": "instantiation", + "oparetion_right": "increase", + "vnf_name": "", + "vm_list": [{ + "vm_flavor": { + "vdu_name": "OMU_VDU", + "location": "", + "num_cpus": "", + "mem_size": "", + "proirity": "", + "storage": [{ + "vol_type": "network_storage", + "vol_size": "512" + }] + }, + "init_number": "" + }] + } + } + }, + "response": { + "status": 400, + "json": { + "grant": { + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcesuccess.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcesuccess.json new file mode 100644 index 00000000..4e2c3cef --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcesuccess.json @@ -0,0 +1,41 @@ +{ + "request": { + "uri": "/rest/vnfmmed/csm/v2/vapps/instances/123456/grant", + "method": "put", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "grant": { + "vnf_id":"", + "project_id": "", + "type": "instantiation", + "oparetion_right": "increase", + "vnf_name": "", + "vm_list": [{ + "vm_flavor": { + "vdu_name": "OMU_VDU", + "location": "", + "num_cpus": "", + "mem_size": "", + "proirity": "", + "storage": [{ + "vol_type": "network_storage", + "vol_size": "512" + }] + }, + "init_number": "" + }] + } + } + }, + "response": { + "status": 200, + "json": { + "grant": { + "vim_id": "", + "vnf_id": "" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnffail.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnffail.json new file mode 100644 index 00000000..de6fbfb5 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnffail.json @@ -0,0 +1,45 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/vnfs", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "VNFM": { + "name":"vsnfm1", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "extro_info": { + + } + } + } + }, + "response": { + "status": 400, + "json": { + "retCode": 1, + "data": { + "name":"vsnfm1", + "updateAt": "2016-09-30 16:03:15", + "createAt": "2016-09-30 16:10:15", + "id": "fj392842fj32jf392fj392f", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "extro_info": { + + }, + "status": "active" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnfsuccess.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnfsuccess.json new file mode 100644 index 00000000..646d04b6 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnfsuccess.json @@ -0,0 +1,44 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/vnfs", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + "name":"vsnfm1", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "vnfPackageId": "12345", + "extro_info": { + + } + } + }, + "response": { + "status": 200, + "json": { + "retCode": 1, + "data": { + "name":"vsnfm1", + "updateAt": "2016-09-30 16:03:15", + "createAt": "2016-09-30 16:10:15", + "id": "fj392842fj32jf392fj392f", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "extro_info": { + + }, + "status": "active" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnffail.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnffail.json new file mode 100644 index 00000000..e2105a9b --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnffail.json @@ -0,0 +1,18 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/vnfs/54321/terminate", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 400, + "json": { + "retCode": 1, + "data": "delete vnf success" + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnfsuccess.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnfsuccess.json new file mode 100644 index 00000000..dce221ac --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnfsuccess.json @@ -0,0 +1,18 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/vnfs/54321/terminate", + "method": "post", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 200, + "json": { + "retCode": 1, + "data": "delete vnf success" + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobfail.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobfail.json new file mode 100644 index 00000000..fe0937cd --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobfail.json @@ -0,0 +1,33 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/jobs/54321", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 400, + "json": { + "retCode": 1, + "data": { + "name":"vsnfm1", + "updateAt": "2016-09-30 16:03:15", + "createAt": "2016-09-30 16:10:15", + "id": "fj392842fj32jf392fj392f", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "extro_info": { + + }, + "status": "active" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobsuccess.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobsuccess.json new file mode 100644 index 00000000..1aa63ca8 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobsuccess.json @@ -0,0 +1,33 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/jobs/54321", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 200, + "json": { + "retCode": 1, + "data": { + "name":"vsnfm1", + "updateAt": "2016-09-30 16:03:15", + "createAt": "2016-09-30 16:10:15", + "id": "fj392842fj32jf392fj392f", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "extro_info": { + + }, + "status": "active" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnffail.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnffail.json new file mode 100644 index 00000000..1b0349e9 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnffail.json @@ -0,0 +1,33 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/vnfs/54321", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 400, + "json": { + "retCode": 1, + "data": { + "name":"vsnfm1", + "updateAt": "2016-09-30 16:03:15", + "createAt": "2016-09-30 16:10:15", + "id": "fj392842fj32jf392fj392f", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "extro_info": { + + }, + "status": "active" + } + } + } +} \ No newline at end of file diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnfsuccess.json b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnfsuccess.json new file mode 100644 index 00000000..0b6525a6 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnfsuccess.json @@ -0,0 +1,33 @@ +{ + "request": { + "uri": "/rest/openoapi/hw-vnfm/v1/12345/vnfs/54321", + "method": "get", + "headers": { + "Content-Type": "application/json;charset=UTF-8" + }, + "json": { + } + }, + "response": { + "status": 200, + "json": { + "retCode": 1, + "data": { + "name":"vsnfm1", + "updateAt": "2016-09-30 16:03:15", + "createAt": "2016-09-30 16:10:15", + "id": "fj392842fj32jf392fj392f", + "url": "https://188.100.100.86:30001", + "type": "csm", + "version": "v1", + "userName": "manoadmin", + "sites": ["Miano","Roma"], + "pwd": "User@12345", + "extro_info": { + + }, + "status": "active" + } + } + } +} \ No newline at end of file -- cgit 1.2.3-korg