summaryrefslogtreecommitdiffstats
path: root/juju/juju-vnfmadapter
diff options
context:
space:
mode:
authorQuan-Zhong <quanzhong@huawei.com>2017-07-04 17:30:27 +0800
committerQuan-Zhong <quanzhong@huawei.com>2017-07-04 17:30:27 +0800
commit308af7411c9f9cdb065da07b6d77e32f5911e7a1 (patch)
tree37e42ceddc177a6dc1a69bac096c80f506ea8d22 /juju/juju-vnfmadapter
parent381a045ffca7ee96cf63a919220c619b0aafe8ed (diff)
add gvnfm codes
NFVO-127 Change-Id: I447ff20ed2559d6b77041879f6abc15710acb501 Signed-off-by: Quan-Zhong <quanzhong@huawei.com>
Diffstat (limited to 'juju/juju-vnfmadapter')
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/pom.xml116
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/README.txt56
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/init_db.sh52
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/start.sh45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/stop.sh41
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.policy212
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.properties130
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/context.xml30
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/juju-vnfmadapterservice_route.json14
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/logging.properties70
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/server.xml47
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/web.xml4689
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/db/mysql/db-schema.sql50
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo.json14
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo2drivermgr.json28
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/juju_conf.json6
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/restclient.json11
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/csarInfo/csarinfo.json4
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/pom.xml39
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/pom.xml215
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/all-tests/config.properties16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/dev/config.properties16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/integration-test/config.properties16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java84
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java92
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java84
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties29
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json18
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/server.properties29
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestFail.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestSuccess.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/deploySerivce.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/destroySerivce.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/getVnfStatus.json18
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallback.java46
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/BaseTimeJob.java85
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtil.java63
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManager.java240
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtils.java297
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtils.java501
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtil.java49
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtils.java263
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtil.java45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolder.java107
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtil.java148
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SwitchController.java55
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtil.java301
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtil.java420
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmException.java84
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtil.java95
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtil.java125
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelp.java79
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelp.java69
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtil.java315
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfo.java147
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtil.java437
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtil.java401
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokens.java136
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessor.java61
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManager.java302
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManager.java111
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManager.java110
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java449
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2DriverManager.java52
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2MSBManager.java56
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuClientManager.java84
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IResourceManager.java53
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapter2DriverMgrService.java183
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrService.java196
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapter2DriverMgrService.java43
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapterMgrService.java45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/Constant.java219
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstants.java144
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstant.java54
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriver.java203
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfd.java93
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfm.java366
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfo.java141
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExample.java1682
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntity.java370
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/Vnfm.java232
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResult.java125
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationException.java34
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuClientUtils.java97
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuHelper.java54
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/PyObjectFactory.java104
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Config.java45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItem.java60
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Options.java23
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/mapper/JujuVnfmInfoMapper.java149
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgr.java403
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgr.java240
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoa.java193
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoa.java252
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/SwaggerRoa.java49
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoa.java102
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoa.java256
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessage.java64
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapper.java41
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapper.java45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/db.properties20
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/juju-config.properties26
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/log4j.properties28
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/mybatis/mysql/JujuVnfmInfoMapper.xml382
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/services.xml125
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/svc_register.xml42
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/swagger.json608
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/webapp/WEB-INF/web.xml51
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallbackTest.java44
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtilTest.java42
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManagerTest.java42
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtilsTest.java63
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtil.java50
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtilsTest.java94
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtilTest.java35
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtilsTest.java57
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtilTest.java40
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolderTest.java44
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtilTest.java122
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/TestPojo.java47
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtilTest.java78
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtilTest.java250
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtilTest.java123
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtilTest.java48
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelpTest.java58
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelpTest.java58
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtilTest.java247
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfoTest.java68
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtilTest.java257
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtilTest.java224
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokensTest.java98
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/ServiceTokenHelpTest.java28
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessorTest.java34
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java212
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManagerTest.java267
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManagerTest.java126
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/ProcessMockImpl.java76
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrServiceTest.java28
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ConstantTest.java42
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstantsTest.java35
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstantTest.java34
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriverTest.java309
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfdTest.java154
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExampleTest.java165
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoTest.java182
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmTest.java347
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntityTest.java79
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResultTest.java129
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmTest.java347
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationExceptionTest.java36
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItemTest.java45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigTest.java40
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/OptionsTest.java35
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgrTest.java404
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgrTest.java80
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoaTest.java85
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoaTest.java132
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/TestMockUp.java61
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoaTest.java59
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoaTest.java215
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessageTest.java45
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapperTest.java43
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapperTest.java44
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/JujuClientRoaTest.java163
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/TestHelper.java72
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/deployService.json4
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/destroyService.json2
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/example.json1
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/setCharmUrl.json2
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.xml41
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.yaml10
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/webapp/webtest.xml15
-rw-r--r--juju/juju-vnfmadapter/pom.xml74
177 files changed, 26265 insertions, 0 deletions
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/pom.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/pom.xml
new file mode 100644
index 0000000..9c46f98
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/pom.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openo.nfvo</groupId>
+ <artifactId>juju-vnfmadapter-service-root</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>juju-vnfmadapterservice-deployment</artifactId>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>jujuvnfmadapter package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ System.out.println("******** Going to make release zip ********")
+
+ deployFolder =
+ "${project.build.directory}/deployoutput"
+ deployUnzip =
+ "${project.build.directory}/deployunzip"
+ outfileName =
+ "${package.name}-${project.version}.zip"
+ ant.delete(dir: "${deployFolder}")
+ ant.mkdir(dir:
+ "${deployFolder}")
+
+ ant.delete(dir: "${deployUnzip}")
+ ant.mkdir(dir: "${deployUnzip}")
+
+ ant.mkdir(dir:
+ "${deployUnzip}/webapps/")
+ ant.mkdir(dir: "${deployUnzip}/webapps/ROOT")
+ ant.mkdir(dir:
+ "${deployUnzip}/logs")
+
+ ant.copy(todir: "${deployUnzip}") {
+ fileset(dir: "${basedir}/src/main/release"){
+ exclude(name: "**/.gitignore")
+ }
+ }
+ ant.copy(todir:
+ "${deployUnzip}/webapps/ROOT") {
+ fileset(dir:
+ "${project.build.directory}/../../service/target/${package.name}-${project.version}")
+ }
+
+ ant.zip(destfile:
+ "${deployFolder}/${outfileName}") {
+ fileset(dir: "${deployUnzip}")
+ }
+ System.out.println("******** completed. ************")
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/deployoutput/${package.name}-${project.version}.zip</file>
+ <type>zip</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+
+
+ </plugins>
+ </build>
+<name>nfvo/drivers/vnfm/gvnfm/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment</name></project>
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/README.txt b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/README.txt
new file mode 100644
index 0000000..5b62c97
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/README.txt
@@ -0,0 +1,56 @@
+Introduction:
+=============
+ This document provides the required steps for installation
+ and configuration this service.
+
+Installation steps:
+====================
+ Install following software:
+ - Java 1.8 or lattest
+ - MySql Server 5.7 or lattest.
+ - Apache Tomcat Server 8.0 or lattest
+
+ Set the following environment variables:
+ - JAVA_HOME: Set to JAVA JDK installed location
+ - CATALINIA_HOME: Set to Tomcat installed location
+ - CATALINIA_BASE: Set to the location, where this
+ service installer is unzipped, its optional
+ - PATH: Update it with the location of command 'mysql'
+
+ - In command console, cd to 'bin' directory under the location,
+ where this service installer is unzipped and
+ run ./init_db.sh <db user> <db password> <db server ip> <db port>
+ CAUTION: Existing jujuvnfmdb will be cleaned before
+ initializing the schema, so please take a back-up of it
+ before executing it next time.
+
+Configuration steps:
+====================
+ - Update the db credetials in bean with id="source" in 'services.xml'
+ under webapps spring directory.
+ - Update the MSB address in $PATH/etc/conf/restclient.json
+ - Update the jujuvnfm service ip address in $PATH/etc/adapterInfo/jujuadapterinfo.json
+
+How to run?
+===========
+ - In command console, cd to 'bin' directory under the location,
+ where this service installer is unzipped and
+ run ./start.sh
+ NOTE: It starts the tomcat at predefined http port. To change
+ default port, update the port in tomcat configuration file
+ 'conf/server.xml'
+ - Verify that 'Tomcat started.' is reported on the console.
+ - Once service is started, please verify below details:
+ - from MSB service, verify that "jujuvnfm" is reported from GET request on "/openoapi/microservices/v1/services"
+ - from this service, run one of the supported REST API mentioned in open-o NFVO wiki and verify that the
+ expected response is returned.
+How to stop?
+=============
+ - In command console, cd to 'bin' directory under the location,
+ where this service installer is unzipped and
+ run ./stop.sh
+
+Update:
+=========
+The latest information are available through the OPEN-O release notes at
+https://wiki.open-o.org/view/OPEN-O_Sun_Release_Notes
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/init_db.sh b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/init_db.sh
new file mode 100644
index 0000000..4482ae8
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/init_db.sh
@@ -0,0 +1,52 @@
+#*******************************************************************************
+# 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.
+#*******************************************************************************
+#!/bin/bash
+cd ..
+if [ -z "$1" ]
+then
+ echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
+ exit 1
+fi
+if [ -z "$2" ]
+then
+ echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
+ exit 1
+fi
+if [ -z "$3" ]
+then
+ echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
+ exit 1
+fi
+if [ -z "$4" ]
+then
+ echo "usage: init_db.sh <db user> <db password> <db server ip> <db port> "
+ exit 1
+fi
+echo
+echo "DB-INIT [jujuvnfmdb] : START"
+mysql -u$1 -p$2 -h$3 -P$4 <$(cd `dirname $0`; pwd)/db/mysql/db-schema.sql
+if [ $? != 0 ] ; then
+ echo "DB-INIT [jujuvnfmdb] : FAILED !"
+ exit 1
+fi
+echo "DB-INIT [jujuvnfmdb] : PASSED"
+echo
+echo "*************************************************************"
+echo "CAUTION: Existing jujuvnfmdb will be cleaned before"
+echo "initializing the schema, so please take a back-up of it"
+echo "before executing it next time."
+echo "*************************************************************"
+exit 0 \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/start.sh b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/start.sh
new file mode 100644
index 0000000..7d230e6
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/start.sh
@@ -0,0 +1,45 @@
+#
+# 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.
+
+#!/bin/bash
+cd ..
+export CATALINA_BASE=$(cd `dirname $0`; pwd)
+
+if [ -z "$JAVA_HOME" ]
+then
+ echo "There is no JAVA_HOME"
+ exit 1
+fi
+
+if [ -z "$CATALINA_HOME" ]
+then
+ echo "There is no CATALINA_HOME"
+ exit 1
+fi
+
+if [ -z "$CATALINA_BASE" ]
+then
+ echo "There is no CATALINA_BASE"
+ exit 1
+fi
+
+export CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
+
+LOG_DIR=$CATALINA_BASE/logs
+if [ ! -d "$LOG_DIR" ]; then
+ mkdir $LOG_DIR
+fi
+
+$CATALINA_HOME/bin/catalina.sh start \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/stop.sh b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/stop.sh
new file mode 100644
index 0000000..a0acfe6
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/bin/stop.sh
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+#!/bin/bash
+cd ..
+export CATALINA_BASE=$(cd `dirname $0`; pwd)
+
+if [ -z "$JAVA_HOME" ]
+then
+ echo "There is no JAVA_HOME"
+ exit 1
+fi
+
+if [ -z "$CATALINA_HOME" ]
+then
+ echo "There is no CATALINA_HOME"
+ exit 1
+fi
+
+export CATALINA_PID="$CATALINA_BASE/bin/catalina.pid"
+
+if [ -z "$CATALINA_BASE" ]
+then
+ echo "There is no CATALINA_BASE"
+ exit 1
+fi
+
+$CATALINA_HOME/bin/catalina.sh stop -force
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.policy b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.policy
new file mode 100644
index 0000000..9f99104
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.policy
@@ -0,0 +1,212 @@
+// 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.
+
+// ============================================================================
+// catalina.policy - Security Policy Permissions for Tomcat 7
+//
+// This file contains a default set of security policies to be enforced (by the
+// JVM) when Catalina is executed with the "-security" option. In addition
+// to the permissions granted here, the following additional permissions are
+// granted to each web application:
+//
+// * Read access to the web application's document root directory
+// * Read, write and delete access to the web application's working directory
+// ============================================================================
+
+
+// ========== SYSTEM CODE PERMISSIONS =========================================
+
+
+// These permissions apply to javac
+grant codeBase "file:${java.home}/lib/-" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions
+grant codeBase "file:${java.home}/jre/lib/ext/-" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/../lib/-" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions when
+// ${java.home} points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/lib/ext/-" {
+ permission java.security.AllPermission;
+};
+
+
+// ========== CATALINA CODE PERMISSIONS =======================================
+
+
+// These permissions apply to the daemon code
+grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
+ permission java.security.AllPermission;
+};
+
+
+grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
+ permission java.io.FilePermission
+ "${java.home}${file.separator}lib${file.separator}logging.properties", "read";
+
+ permission java.io.FilePermission
+ "${catalina.base}${file.separator}conf${file.separator}logging.properties", "read";
+ permission java.io.FilePermission
+ "${catalina.base}${file.separator}logs", "read, write";
+ permission java.io.FilePermission
+ "${catalina.base}${file.separator}logs${file.separator}*", "read, write";
+
+ permission java.lang.RuntimePermission "shutdownHooks";
+ permission java.lang.RuntimePermission "getClassLoader";
+ permission java.lang.RuntimePermission "setContextClassLoader";
+
+ permission java.util.logging.LoggingPermission "control";
+
+ permission java.util.PropertyPermission "java.util.logging.config.class", "read";
+ permission java.util.PropertyPermission "java.util.logging.config.file", "read";
+ permission java.util.PropertyPermission "org.apache.juli.ClassLoaderLogManager.debug", "read";
+ permission java.util.PropertyPermission "catalina.base", "read";
+
+
+};
+
+// These permissions apply to the server startup code
+grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to the servlet API classes
+// and those that are shared across all class loaders
+// located in the "lib" directory
+grant codeBase "file:${catalina.home}/lib/-" {
+ permission java.security.AllPermission;
+};
+
+
+
+// ========== WEB APPLICATION PERMISSIONS =====================================
+
+
+// These permissions are granted by default to all web applications
+// In addition, a web application will be given a read FilePermission
+// and JndiPermission for all files and directories in its document root.
+grant {
+ // Required for JNDI lookup of named JDBC DataSource's and
+ // javamail named MimePart DataSource used to send mail
+ permission java.util.PropertyPermission "java.home", "read";
+ permission java.util.PropertyPermission "java.naming.*", "read";
+ permission java.util.PropertyPermission "javax.sql.*", "read";
+
+ // OS Specific properties to allow read access
+ permission java.util.PropertyPermission "os.name", "read";
+ permission java.util.PropertyPermission "os.version", "read";
+ permission java.util.PropertyPermission "os.arch", "read";
+ permission java.util.PropertyPermission "file.separator", "read";
+ permission java.util.PropertyPermission "path.separator", "read";
+ permission java.util.PropertyPermission "line.separator", "read";
+
+ // JVM properties to allow read access
+ permission java.util.PropertyPermission "java.version", "read";
+ permission java.util.PropertyPermission "java.vendor", "read";
+ permission java.util.PropertyPermission "java.vendor.url", "read";
+ permission java.util.PropertyPermission "java.class.version", "read";
+ permission java.util.PropertyPermission "java.specification.version", "read";
+ permission java.util.PropertyPermission "java.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.specification.name", "read";
+
+ permission java.util.PropertyPermission "java.vm.specification.version", "read";
+ permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.specification.name", "read";
+ permission java.util.PropertyPermission "java.vm.version", "read";
+ permission java.util.PropertyPermission "java.vm.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.name", "read";
+
+ // Required for OpenJMX
+ permission java.lang.RuntimePermission "getAttribute";
+
+ // Allow read of JAXP compliant XML parser debug
+ permission java.util.PropertyPermission "jaxp.debug", "read";
+
+ // All JSPs need to be able to read this package
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat";
+
+ // Precompiled JSPs need access to these packages.
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.el";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
+ permission java.lang.RuntimePermission
+ "accessClassInPackage.org.apache.jasper.runtime.*";
+
+ // Precompiled JSPs need access to these system properties.
+ permission java.util.PropertyPermission
+ "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read";
+ permission java.util.PropertyPermission
+ "org.apache.el.parser.COERCE_TO_ZERO", "read";
+
+ // The cookie code needs these.
+ permission java.util.PropertyPermission
+ "org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "read";
+ permission java.util.PropertyPermission
+ "org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING", "read";
+ permission java.util.PropertyPermission
+ "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR", "read";
+
+ // Applications using Comet need to be able to access this package
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.comet";
+
+ // Applications using the legacy WebSocket implementation need to be able to access this package
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.websocket";
+
+ // Applications using the JSR-356 WebSocket implementation need to be able to access these packages
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.websocket";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.websocket.server";
+};
+
+
+// The Manager application needs access to the following packages to support the
+// session display functionality. These settings support the following
+// configurations:
+// - default CATALINA_HOME == CATALINA_BASE
+// - CATALINA_HOME != CATALINA_BASE, per instance Manager in CATALINA_BASE
+// - CATALINA_HOME != CATALINA_BASE, shared Manager in CATALINA_HOME
+grant codeBase "file:${catalina.base}/webapps/manager/-" {
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
+};
+grant codeBase "file:${catalina.home}/webapps/manager/-" {
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
+};
+
+// You can assign additional permissions to particular web applications by
+// adding additional "grant" entries here, based on the code base for that
+// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
+//
+// Different permissions can be granted to JSP pages, classes loaded from
+// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
+// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
+//
+// For instance, assume that the standard "examples" application
+// included a JDBC driver that needed to establish a network connection to the
+// corresponding database and used the scrape taglib to get the weather from
+// the NOAA web server. You might create a "grant" entries like this:
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.properties
new file mode 100644
index 0000000..a2393bb
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/catalina.properties
@@ -0,0 +1,130 @@
+# 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.
+
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageAccess unless the
+# corresponding RuntimePermission ("accessClassInPackage."+package) has
+# been granted.
+package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,\
+org.apache.naming.resources.,org.apache.tomcat.
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageDefinition unless the
+# corresponding RuntimePermission ("defineClassInPackage."+package) has
+# been granted.
+#
+# by default, no packages are restricted for definition, and none of
+# the class loaders supplied with the JDK call checkPackageDefinition.
+#
+package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,\
+org.apache.jasper.,org.apache.naming.,org.apache.tomcat.
+
+#
+#
+# List of comma-separated paths defining the contents of the "common"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
+# If left as blank,the JVM system loader will be used as Catalina's "common"
+# loader.
+# Examples:
+# "foo": Add this folder as a class repository
+# "foo/*.jar": Add all the JARs of the specified folder as class
+# repositories
+# "foo/bar.jar": Add bar.jar as a class repository
+common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
+
+#
+# List of comma-separated paths defining the contents of the "server"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
+# If left as blank, the "common" loader will be used as Catalina's "server"
+# loader.
+# Examples:
+# "foo": Add this folder as a class repository
+# "foo/*.jar": Add all the JARs of the specified folder as class
+# repositories
+# "foo/bar.jar": Add bar.jar as a class repository
+server.loader=
+
+#
+# List of comma-separated paths defining the contents of the "shared"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
+# the "common" loader will be used as Catalina's "shared" loader.
+# Examples:
+# "foo": Add this folder as a class repository
+# "foo/*.jar": Add all the JARs of the specified folder as class
+# repositories
+# "foo/bar.jar": Add bar.jar as a class repository
+# Please note that for single jars, e.g. bar.jar, you need the URL form
+# starting with file:.
+shared.loader=
+
+# List of JAR files that should not be scanned using the JarScanner
+# functionality. This is typically used to scan JARs for configuration
+# information. JARs that do not contain such information may be excluded from
+# the scan to speed up the scanning process. This is the default list. JARs on
+# this list are excluded from all scans. Scan specific lists (to exclude JARs
+# from individual scans) follow this. The list must be a comma separated list of
+# JAR file names.
+# The JARs listed below include:
+# - Tomcat Bootstrap JARs
+# - Tomcat API JARs
+# - Catalina JARs
+# - Jasper JARs
+# - Tomcat JARs
+# - Common non-Tomcat JARs
+# - Test JARs (JUnit, Cobertura and dependencies)
+tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
+bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
+annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,\
+catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar,\
+jasper.jar,jasper-el.jar,ecj-*.jar,\
+tomcat-api.jar,tomcat-util.jar,tomcat-coyote.jar,tomcat-dbcp.jar,\
+tomcat-jni.jar,tomcat-spdy.jar,\
+tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,\
+tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,\
+tomcat-jdbc.jar,\
+tools.jar,\
+commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,\
+commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,\
+commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,\
+commons-math*.jar,commons-pool*.jar,\
+jstl.jar,\
+geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\
+ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\
+jmx-tools.jar,jta*.jar,log4j.jar,log4j-1*.jar,mail*.jar,slf4j*.jar,\
+xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\
+junit.jar,junit-*.jar,hamcrest*.jar,org.hamcrest*.jar,ant-launcher.jar,\
+cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,\
+jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,\
+xom-*.jar
+
+# Additional JARs (over and above the default JARs listed above) to skip when
+# scanning for Servlet 3.0 pluggability features. These features include web
+# fragments, annotations, SCIs and classes that match @HandlesTypes. The list
+# must be a comma separated list of JAR file names.
+org.apache.catalina.startup.ContextConfig.jarsToSkip=
+
+# Additional JARs (over and above the default JARs listed above) to skip when
+# scanning for TLDs. The list must be a comma separated list of JAR file names.
+org.apache.catalina.startup.TldConfig.jarsToSkip=tomcat7-websocket.jar
+
+#
+# String cache configuration.
+tomcat.util.buf.StringCache.byte.enabled=true
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/context.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/context.xml
new file mode 100644
index 0000000..64de61f
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/context.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!-- The contents of this file will be loaded for each web application -->
+<Context>
+
+ <!-- Default set of monitored resources. If one of these changes, the -->
+ <!-- web application will be reloaded. -->
+ <WatchedResource>WEB-INF/web.xml</WatchedResource>
+ <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
+
+ <!-- Uncomment this to disable session persistence across Tomcat restarts -->
+ <!--
+ <Manager pathname="" />
+ -->
+</Context>
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/juju-vnfmadapterservice_route.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/juju-vnfmadapterservice_route.json
new file mode 100644
index 0000000..bdcc38b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/juju-vnfmadapterservice_route.json
@@ -0,0 +1,14 @@
+{
+ "service":{
+ "name":"juju-vnfmadapterservice",
+ "url": ["/aaa/v1/user","/aaa/v1/roles", "/aaa/v1/auth", "/aaa/v1/tickets", "aaa/v1/servicetickets", "aaa/v1/value"],
+ "instance":
+ [
+ {
+ "name":"juju-vnfmadapterservice-0-0",
+ "ip":"127.0.0.1",
+ "port": 9094
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/logging.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/logging.properties
new file mode 100644
index 0000000..a2ad9c2
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/logging.properties
@@ -0,0 +1,70 @@
+# 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.
+
+handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+1catalina.org.apache.juli.AsyncFileHandler.level = FINE
+1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
+1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
+
+2localhost.org.apache.juli.AsyncFileHandler.level = FINE
+2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
+2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
+
+3manager.org.apache.juli.AsyncFileHandler.level = FINE
+3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
+3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
+
+4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
+4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
+4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler
+
+# For example, set the org.apache.catalina.util.LifecycleBase logger to log
+# each component that extends LifecycleBase changing state:
+#org.apache.catalina.util.LifecycleBase.level = FINE
+
+# To see debug messages in TldLocationsCache, uncomment the following line:
+#org.apache.jasper.compiler.TldLocationsCache.level = FINE
+
+# To see debug messages for HTTP/2 handling, uncomment the following line:
+#org.apache.coyote.http2.level = FINE
+
+# To see debug messages for WebSocket handling, uncomment the following line:
+#org.apache.tomcat.websocket.level = FINE
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/server.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/server.xml
new file mode 100644
index 0000000..bd5c0b0
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/server.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!-- Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" at this level.
+ Documentation at /docs/config/server.html
+ -->
+<Server port="9483" shutdown="SHUTDOWN">
+ <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
+ <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener" />
+ <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+ <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+ <GlobalNamingResources>
+ <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase" />
+ </GlobalNamingResources>
+ <Service name="Catalina">
+ <Connector connectionTimeout="20000" port="8483" protocol="HTTP/1.1" redirectPort="8443" />
+ <Connector port="8822" protocol="AJP/1.3" redirectPort="8443" />
+ <Engine defaultHost="localhost" name="Catalina">
+ <Realm className="org.apache.catalina.realm.LockOutRealm">
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
+ </Realm>
+
+ <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+ pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt" />
+ <Context docBase="ROOT" path="" reloadable="true" />
+ </Host>
+ </Engine>
+ </Service>
+</Server> \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/web.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/web.xml
new file mode 100644
index 0000000..793a8a8
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/conf/web.xml
@@ -0,0 +1,4689 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+ http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
+ version="3.1">
+
+ <!-- ======================== Introduction ============================== -->
+ <!-- This document defines default values for *all* web applications -->
+ <!-- loaded into this instance of Tomcat. As each application is -->
+ <!-- deployed, this file is processed, followed by the -->
+ <!-- "/WEB-INF/web.xml" deployment descriptor from your own -->
+ <!-- applications. -->
+ <!-- -->
+ <!-- WARNING: Do not configure application-specific resources here! -->
+ <!-- They should go in the "/WEB-INF/web.xml" file in your application. -->
+
+
+ <!-- ================== Built In Servlet Definitions ==================== -->
+
+
+ <!-- The default servlet for all web applications, that serves static -->
+ <!-- resources. It processes all requests that are not mapped to other -->
+ <!-- servlets with servlet mappings (defined either here or in your own -->
+ <!-- web.xml file). This servlet supports the following initialization -->
+ <!-- parameters (default values are in square brackets): -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. Useful values are 0, 1, and -->
+ <!-- 11 where higher values mean more detail. [0] -->
+ <!-- -->
+ <!-- fileEncoding Encoding to be used to read static resources -->
+ <!-- [platform default] -->
+ <!-- -->
+ <!-- input Input buffer size (in bytes) when reading -->
+ <!-- resources to be served. [2048] -->
+ <!-- -->
+ <!-- listings Should directory listings be produced if there -->
+ <!-- is no welcome file in this directory? [false] -->
+ <!-- WARNING: Listings for directories with many -->
+ <!-- entries can be slow and may consume -->
+ <!-- significant proportions of server resources. -->
+ <!-- -->
+ <!-- output Output buffer size (in bytes) when writing -->
+ <!-- resources to be served. [2048] -->
+ <!-- -->
+ <!-- readonly Is this context "read only", so HTTP -->
+ <!-- commands like PUT and DELETE are -->
+ <!-- rejected? [true] -->
+ <!-- -->
+ <!-- readmeFile File to display together with the directory -->
+ <!-- contents. [null] -->
+ <!-- -->
+ <!-- sendfileSize If the connector used supports sendfile, this -->
+ <!-- represents the minimal file size in KB for -->
+ <!-- which sendfile will be used. Use a negative -->
+ <!-- value to always disable sendfile. [48] -->
+ <!-- -->
+ <!-- useAcceptRanges Should the Accept-Ranges header be included -->
+ <!-- in responses where appropriate? [true] -->
+ <!-- -->
+ <!-- For directory listing customization. Checks localXsltFile, then -->
+ <!-- globalXsltFile, then defaults to original behavior. -->
+ <!-- -->
+ <!-- localXsltFile Make directory listings an XML doc and -->
+ <!-- pass the result to this style sheet residing -->
+ <!-- in that directory. This overrides -->
+ <!-- contextXsltFile and globalXsltFile[null] -->
+ <!-- -->
+ <!-- contextXsltFile Make directory listings an XML doc and -->
+ <!-- pass the result to this style sheet which is -->
+ <!-- relative to the context root. This overrides -->
+ <!-- globalXsltFile[null] -->
+ <!-- -->
+ <!-- globalXsltFile Site wide configuration version of -->
+ <!-- localXsltFile. This argument must either be an -->
+ <!-- absolute or relative (to either -->
+ <!-- $CATALINA_BASE/conf or $CATALINA_HOME/conf) -->
+ <!-- path that points to a location below either -->
+ <!-- $CATALINA_BASE/conf (checked first) or -->
+ <!-- $CATALINA_HOME/conf (checked second).[null] -->
+ <!-- -->
+ <!-- showServerInfo Should server information be presented in the -->
+ <!-- response sent to clients when directory -->
+ <!-- listings is enabled? [true] -->
+
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>listings</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- The JSP page compiler and execution servlet, which is the mechanism -->
+ <!-- used by Tomcat to support JSP pages. Traditionally, this servlet -->
+ <!-- is mapped to the URL pattern "*.jsp". This servlet supports the -->
+ <!-- following initialization parameters (default values are in square -->
+ <!-- brackets): -->
+ <!-- -->
+ <!-- checkInterval If development is false and checkInterval is -->
+ <!-- greater than zero, background compilations are -->
+ <!-- enabled. checkInterval is the time in seconds -->
+ <!-- between checks to see if a JSP page (and its -->
+ <!-- dependent files) needs to be recompiled. [0] -->
+ <!-- -->
+ <!-- classdebuginfo Should the class file be compiled with -->
+ <!-- debugging information? [true] -->
+ <!-- -->
+ <!-- classpath What class path should I use while compiling -->
+ <!-- generated servlets? [Created dynamically -->
+ <!-- based on the current web application] -->
+ <!-- -->
+ <!-- compiler Which compiler Ant should use to compile JSP -->
+ <!-- pages. See the jasper documentation for more -->
+ <!-- information. -->
+ <!-- -->
+ <!-- compilerSourceVM Compiler source VM. [1.7] -->
+ <!-- -->
+ <!-- compilerTargetVM Compiler target VM. [1.7] -->
+ <!-- -->
+ <!-- development Is Jasper used in development mode? If true, -->
+ <!-- the frequency at which JSPs are checked for -->
+ <!-- modification may be specified via the -->
+ <!-- modificationTestInterval parameter. [true] -->
+ <!-- -->
+ <!-- displaySourceFragment -->
+ <!-- Should a source fragment be included in -->
+ <!-- exception messages? [true] -->
+ <!-- -->
+ <!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
+ <!-- dumped to a file? [false] -->
+ <!-- False if suppressSmap is true -->
+ <!-- -->
+ <!-- enablePooling Determines whether tag handler pooling is -->
+ <!-- enabled. This is a compilation option. It will -->
+ <!-- not alter the behaviour of JSPs that have -->
+ <!-- already been compiled. [true] -->
+ <!-- -->
+ <!-- engineOptionsClass Allows specifying the Options class used to -->
+ <!-- configure Jasper. If not present, the default -->
+ <!-- EmbeddedServletOptions will be used. -->
+ <!-- -->
+ <!-- errorOnUseBeanInvalidClassAttribute -->
+ <!-- Should Jasper issue an error when the value of -->
+ <!-- the class attribute in an useBean action is -->
+ <!-- not a valid bean class? [true] -->
+ <!-- -->
+ <!-- fork Tell Ant to fork compiles of JSP pages so that -->
+ <!-- a separate JVM is used for JSP page compiles -->
+ <!-- from the one Tomcat is running in. [true] -->
+ <!-- -->
+ <!-- genStringAsCharArray -->
+ <!-- Should text strings be generated as char -->
+ <!-- arrays, to improve performance in some cases? -->
+ <!-- [false] -->
+ <!-- -->
+ <!-- ieClassId The class-id value to be sent to Internet -->
+ <!-- Explorer when using <jsp:plugin> tags. -->
+ <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
+ <!-- -->
+ <!-- javaEncoding Java file encoding to use for generating java -->
+ <!-- source files. [UTF8] -->
+ <!-- -->
+ <!-- keepgenerated Should we keep the generated Java source code -->
+ <!-- for each page instead of deleting it? [true] -->
+ <!-- -->
+ <!-- mappedfile Should we generate static content with one -->
+ <!-- print statement per input line, to ease -->
+ <!-- debugging? [true] -->
+ <!-- -->
+ <!-- maxLoadedJsps The maximum number of JSPs that will be loaded -->
+ <!-- for a web application. If more than this -->
+ <!-- number of JSPs are loaded, the least recently -->
+ <!-- used JSPs will be unloaded so that the number -->
+ <!-- of JSPs loaded at any one time does not exceed -->
+ <!-- this limit. A value of zero or less indicates -->
+ <!-- no limit. [-1] -->
+ <!-- -->
+ <!-- jspIdleTimeout The amount of time in seconds a JSP can be -->
+ <!-- idle before it is unloaded. A value of zero -->
+ <!-- or less indicates never unload. [-1] -->
+ <!-- -->
+ <!-- modificationTestInterval -->
+ <!-- Causes a JSP (and its dependent files) to not -->
+ <!-- be checked for modification during the -->
+ <!-- specified time interval (in seconds) from the -->
+ <!-- last time the JSP was checked for -->
+ <!-- modification. A value of 0 will cause the JSP -->
+ <!-- to be checked on every access. -->
+ <!-- Used in development mode only. [4] -->
+ <!-- -->
+ <!-- recompileOnFail If a JSP compilation fails should the -->
+ <!-- modificationTestInterval be ignored and the -->
+ <!-- next access trigger a re-compilation attempt? -->
+ <!-- Used in development mode only and is disabled -->
+ <!-- by default as compilation may be expensive and -->
+ <!-- could lead to excessive resource usage. -->
+ <!-- [false] -->
+ <!-- -->
+ <!-- scratchdir What scratch directory should we use when -->
+ <!-- compiling JSP pages? [default work directory -->
+ <!-- for the current web application] -->
+ <!-- -->
+ <!-- suppressSmap Should the generation of SMAP info for JSR45 -->
+ <!-- debugging be suppressed? [false] -->
+ <!-- -->
+ <!-- trimSpaces Should white spaces in template text between -->
+ <!-- actions or directives be trimmed? [false] -->
+ <!-- -->
+ <!-- xpoweredBy Determines whether X-Powered-By response -->
+ <!-- header is added by generated servlet. [false] -->
+ <!-- -->
+ <!-- strictQuoteEscaping When scriptlet expressions are used for -->
+ <!-- attribute values, should the rules in JSP.1.6 -->
+ <!-- for the escaping of quote characters be -->
+ <!-- strictly applied? [true] -->
+ <!-- -->
+ <!-- quoteAttributeEL When EL is used in an attribute value on a -->
+ <!-- JSP page should the rules for quoting of -->
+ <!-- attributes described in JSP.1.6 be applied to -->
+ <!-- the expression? [true] -->
+
+ <servlet>
+ <servlet-name>jsp</servlet-name>
+ <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
+ <init-param>
+ <param-name>fork</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>xpoweredBy</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <load-on-startup>3</load-on-startup>
+ </servlet>
+
+
+ <!-- NOTE: An SSI Filter is also available as an alternative SSI -->
+ <!-- implementation. Use either the Servlet or the Filter but NOT both. -->
+ <!-- -->
+ <!-- Server Side Includes processing servlet, which processes SSI -->
+ <!-- directives in HTML pages consistent with similar support in web -->
+ <!-- servers like Apache. Traditionally, this servlet is mapped to the -->
+ <!-- URL pattern "*.shtml". This servlet supports the following -->
+ <!-- initialization parameters (default values are in square brackets): -->
+ <!-- -->
+ <!-- buffered Should output from this servlet be buffered? -->
+ <!-- (0=false, 1=true) [0] -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- expires The number of seconds before a page with SSI -->
+ <!-- directives will expire. [No default] -->
+ <!-- -->
+ <!-- isVirtualWebappRelative -->
+ <!-- Should "virtual" paths be interpreted as -->
+ <!-- relative to the context root, instead of -->
+ <!-- the server root? [false] -->
+ <!-- -->
+ <!-- inputEncoding The encoding to assume for SSI resources if -->
+ <!-- one is not available from the resource. -->
+ <!-- [Platform default] -->
+ <!-- -->
+ <!-- outputEncoding The encoding to use for the page that results -->
+ <!-- from the SSI processing. [UTF-8] -->
+ <!-- -->
+ <!-- allowExec Is use of the exec command enabled? [false] -->
+
+<!--
+ <servlet>
+ <servlet-name>ssi</servlet-name>
+ <servlet-class>
+ org.apache.catalina.ssi.SSIServlet
+ </servlet-class>
+ <init-param>
+ <param-name>buffered</param-name>
+ <param-value>1</param-value>
+ </init-param>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>expires</param-name>
+ <param-value>666</param-value>
+ </init-param>
+ <init-param>
+ <param-name>isVirtualWebappRelative</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <load-on-startup>4</load-on-startup>
+ </servlet>
+-->
+
+
+ <!-- Common Gateway Includes (CGI) processing servlet, which supports -->
+ <!-- execution of external applications that conform to the CGI spec -->
+ <!-- requirements. Typically, this servlet is mapped to the URL pattern -->
+ <!-- "/cgi-bin/*", which means that any CGI applications that are -->
+ <!-- executed must be present within the web application. This servlet -->
+ <!-- supports the following initialization parameters (default values -->
+ <!-- are in square brackets): -->
+ <!-- -->
+ <!-- cgiPathPrefix The CGI search path will start at -->
+ <!-- webAppRootDir + File.separator + this prefix. -->
+ <!-- If not set, then webAppRootDir is used. -->
+ <!-- Recommended value: WEB-INF/cgi -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. Useful values range from 0 -->
+ <!-- to 5 where 0 means no logging and 5 means -->
+ <!-- maximum logging. Values of 10 or more mean -->
+ <!-- maximum logging plus debug info added to the -->
+ <!-- HTTP response. If an error occurs and debug -->
+ <!-- is 10 or more the standard error page -->
+ <!-- mechanism will be disabled and a response -->
+ <!-- body with debug information will be produced. -->
+ <!-- Note that any value of 10 or more has the -->
+ <!-- same effect as a value of 10. If set to 10 or -->
+ <!-- more the standard error page mechanism will -->
+ <!-- be disabled and a debug page shown instead. -->
+ <!-- The debug page is not considered secure and -->
+ <!-- should not be enabled for production systems. -->
+ <!-- [0] -->
+ <!-- -->
+ <!-- executable Name of the executable used to run the -->
+ <!-- script. [perl] -->
+ <!-- -->
+ <!-- parameterEncoding Name of parameter encoding to be used with -->
+ <!-- CGI servlet. -->
+ <!-- [System.getProperty("file.encoding","UTF-8")] -->
+ <!-- -->
+ <!-- passShellEnvironment Should the shell environment variables (if -->
+ <!-- any) be passed to the CGI script? [false] -->
+ <!-- -->
+ <!-- stderrTimeout The time (in milliseconds) to wait for the -->
+ <!-- reading of stderr to complete before -->
+ <!-- terminating the CGI process. [2000] -->
+
+<!--
+ <servlet>
+ <servlet-name>cgi</servlet-name>
+ <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cgiPathPrefix</param-name>
+ <param-value>WEB-INF/cgi</param-value>
+ </init-param>
+ <load-on-startup>5</load-on-startup>
+ </servlet>
+-->
+
+
+ <!-- ================ Built In Servlet Mappings ========================= -->
+
+
+ <!-- The servlet mappings for the built in servlets defined above. Note -->
+ <!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
+ <!-- must uncomment these mappings (or add them to your application's own -->
+ <!-- web.xml deployment descriptor) to enable these services -->
+
+ <!-- The mapping for the default servlet -->
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+ <!-- The mappings for the JSP servlet -->
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jsp</url-pattern>
+ <url-pattern>*.jspx</url-pattern>
+ </servlet-mapping>
+
+ <!-- The mapping for the SSI servlet -->
+<!--
+ <servlet-mapping>
+ <servlet-name>ssi</servlet-name>
+ <url-pattern>*.shtml</url-pattern>
+ </servlet-mapping>
+-->
+
+ <!-- The mapping for the CGI Gateway servlet -->
+
+<!--
+ <servlet-mapping>
+ <servlet-name>cgi</servlet-name>
+ <url-pattern>/cgi-bin/*</url-pattern>
+ </servlet-mapping>
+-->
+
+
+ <!-- ================== Built In Filter Definitions ===================== -->
+
+ <!-- A filter that sets various security related HTTP Response headers. -->
+ <!-- This filter supports the following initialization parameters -->
+ <!-- (default values are in square brackets): -->
+ <!-- -->
+ <!-- hstsEnabled Should the HTTP Strict Transport Security -->
+ <!-- (HSTS) header be added to the response? See -->
+ <!-- RFC 6797 for more information on HSTS. [true] -->
+ <!-- -->
+ <!-- hstsMaxAgeSeconds The max age value that should be used in the -->
+ <!-- HSTS header. Negative values will be treated -->
+ <!-- as zero. [0] -->
+ <!-- -->
+ <!-- hstsIncludeSubDomains -->
+ <!-- Should the includeSubDomains parameter be -->
+ <!-- included in the HSTS header. -->
+ <!-- -->
+ <!-- antiClickJackingEnabled -->
+ <!-- Should the anti click-jacking header -->
+ <!-- X-Frame-Options be added to every response? -->
+ <!-- [true] -->
+ <!-- -->
+ <!-- antiClickJackingOption -->
+ <!-- What value should be used for the header. Must -->
+ <!-- be one of DENY, SAMEORIGIN, ALLOW-FROM -->
+ <!-- (case-insensitive). [DENY] -->
+ <!-- -->
+ <!-- antiClickJackingUri IF ALLOW-FROM is used, what URI should be -->
+ <!-- allowed? [] -->
+ <!-- -->
+ <!-- blockContentTypeSniffingEnabled -->
+ <!-- Should the header that blocks content type -->
+ <!-- sniffing be added to every response? [true] -->
+<!--
+ <filter>
+ <filter-name>httpHeaderSecurity</filter-name>
+ <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
+ <async-supported>true</async-supported>
+ </filter>
+-->
+
+ <!-- A filter that sets character encoding that is used to decode -->
+ <!-- parameters in a POST request -->
+<!--
+ <filter>
+ <filter-name>setCharacterEncodingFilter</filter-name>
+ <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
+ <init-param>
+ <param-name>encoding</param-name>
+ <param-value>UTF-8</param-value>
+ </init-param>
+ <async-supported>true</async-supported>
+ </filter>
+-->
+
+ <!-- A filter that triggers request parameters parsing and rejects the -->
+ <!-- request if some parameters were skipped because of parsing errors or -->
+ <!-- request size limitations. -->
+<!--
+ <filter>
+ <filter-name>failedRequestFilter</filter-name>
+ <filter-class>
+ org.apache.catalina.filters.FailedRequestFilter
+ </filter-class>
+ <async-supported>true</async-supported>
+ </filter>
+-->
+
+
+ <!-- NOTE: An SSI Servlet is also available as an alternative SSI -->
+ <!-- implementation. Use either the Servlet or the Filter but NOT both. -->
+ <!-- -->
+ <!-- Server Side Includes processing filter, which processes SSI -->
+ <!-- directives in HTML pages consistent with similar support in web -->
+ <!-- servers like Apache. Traditionally, this filter is mapped to the -->
+ <!-- URL pattern "*.shtml", though it can be mapped to "*" as it will -->
+ <!-- selectively enable/disable SSI processing based on mime types. For -->
+ <!-- this to work you will need to uncomment the .shtml mime type -->
+ <!-- definition towards the bottom of this file. -->
+ <!-- The contentType init param allows you to apply SSI processing to JSP -->
+ <!-- pages, javascript, or any other content you wish. This filter -->
+ <!-- supports the following initialization parameters (default values are -->
+ <!-- in square brackets): -->
+ <!-- -->
+ <!-- contentType A regex pattern that must be matched before -->
+ <!-- SSI processing is applied. -->
+ <!-- [text/x-server-parsed-html(;.*)?] -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- expires The number of seconds before a page with SSI -->
+ <!-- directives will expire. [No default] -->
+ <!-- -->
+ <!-- isVirtualWebappRelative -->
+ <!-- Should "virtual" paths be interpreted as -->
+ <!-- relative to the context root, instead of -->
+ <!-- the server root? [false] -->
+ <!-- -->
+ <!-- allowExec Is use of the exec command enabled? [false] -->
+
+<!--
+ <filter>
+ <filter-name>ssi</filter-name>
+ <filter-class>
+ org.apache.catalina.ssi.SSIFilter
+ </filter-class>
+ <init-param>
+ <param-name>contentType</param-name>
+ <param-value>text/x-server-parsed-html(;.*)?</param-value>
+ </init-param>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>expires</param-name>
+ <param-value>666</param-value>
+ </init-param>
+ <init-param>
+ <param-name>isVirtualWebappRelative</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ </filter>
+-->
+
+
+ <!-- ==================== Built In Filter Mappings ====================== -->
+
+ <!-- The mapping for the HTTP header security Filter -->
+<!--
+ <filter-mapping>
+ <filter-name>httpHeaderSecurity</filter-name>
+ <url-pattern>/*</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+-->
+
+ <!-- The mapping for the Set Character Encoding Filter -->
+<!--
+ <filter-mapping>
+ <filter-name>setCharacterEncodingFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+-->
+
+ <!-- The mapping for the Failed Request Filter -->
+<!--
+ <filter-mapping>
+ <filter-name>failedRequestFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+-->
+
+ <!-- The mapping for the SSI Filter -->
+<!--
+ <filter-mapping>
+ <filter-name>ssi</filter-name>
+ <url-pattern>*.shtml</url-pattern>
+ </filter-mapping>
+-->
+
+
+ <!-- ==================== Default Session Configuration ================= -->
+ <!-- You can set the default session timeout (in minutes) for all newly -->
+ <!-- created sessions by modifying the value below. -->
+
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+
+ <!-- ===================== Default MIME Type Mappings =================== -->
+ <!-- When serving static resources, Tomcat will automatically generate -->
+ <!-- a "Content-Type" header based on the resource's filename extension, -->
+ <!-- based on these mappings. Additional mappings can be added here (to -->
+ <!-- apply to all web applications), or in your own application's web.xml -->
+ <!-- deployment descriptor. -->
+ <!-- Note: Extensions are always matched in a case-insensitive manner. -->
+
+ <mime-mapping>
+ <extension>123</extension>
+ <mime-type>application/vnd.lotus-1-2-3</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>3dml</extension>
+ <mime-type>text/vnd.in3d.3dml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>3ds</extension>
+ <mime-type>image/x-3ds</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>3g2</extension>
+ <mime-type>video/3gpp2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>3gp</extension>
+ <mime-type>video/3gpp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>7z</extension>
+ <mime-type>application/x-7z-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aab</extension>
+ <mime-type>application/x-authorware-bin</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aac</extension>
+ <mime-type>audio/x-aac</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aam</extension>
+ <mime-type>application/x-authorware-map</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aas</extension>
+ <mime-type>application/x-authorware-seg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>abs</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>abw</extension>
+ <mime-type>application/x-abiword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ac</extension>
+ <mime-type>application/pkix-attr-cert</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>acc</extension>
+ <mime-type>application/vnd.americandynamics.acc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ace</extension>
+ <mime-type>application/x-ace-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>acu</extension>
+ <mime-type>application/vnd.acucobol</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>acutc</extension>
+ <mime-type>application/vnd.acucorp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>adp</extension>
+ <mime-type>audio/adpcm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aep</extension>
+ <mime-type>application/vnd.audiograph</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>afm</extension>
+ <mime-type>application/x-font-type1</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>afp</extension>
+ <mime-type>application/vnd.ibm.modcap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ahead</extension>
+ <mime-type>application/vnd.ahead.space</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ai</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aif</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aifc</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aiff</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aim</extension>
+ <mime-type>application/x-aim</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>air</extension>
+ <mime-type>application/vnd.adobe.air-application-installer-package+zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ait</extension>
+ <mime-type>application/vnd.dvb.ait</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ami</extension>
+ <mime-type>application/vnd.amiga.ami</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>anx</extension>
+ <mime-type>application/annodex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>apk</extension>
+ <mime-type>application/vnd.android.package-archive</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>appcache</extension>
+ <mime-type>text/cache-manifest</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>application</extension>
+ <mime-type>application/x-ms-application</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>apr</extension>
+ <mime-type>application/vnd.lotus-approach</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>arc</extension>
+ <mime-type>application/x-freearc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>art</extension>
+ <mime-type>image/x-jg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asc</extension>
+ <mime-type>application/pgp-signature</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asf</extension>
+ <mime-type>video/x-ms-asf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asm</extension>
+ <mime-type>text/x-asm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aso</extension>
+ <mime-type>application/vnd.accpac.simply.aso</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asx</extension>
+ <mime-type>video/x-ms-asf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>atc</extension>
+ <mime-type>application/vnd.acucorp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>atom</extension>
+ <mime-type>application/atom+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>atomcat</extension>
+ <mime-type>application/atomcat+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>atomsvc</extension>
+ <mime-type>application/atomsvc+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>atx</extension>
+ <mime-type>application/vnd.antix.game-component</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>au</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>avi</extension>
+ <mime-type>video/x-msvideo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>avx</extension>
+ <mime-type>video/x-rad-screenplay</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aw</extension>
+ <mime-type>application/applixware</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>axa</extension>
+ <mime-type>audio/annodex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>axv</extension>
+ <mime-type>video/annodex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>azf</extension>
+ <mime-type>application/vnd.airzip.filesecure.azf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>azs</extension>
+ <mime-type>application/vnd.airzip.filesecure.azs</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>azw</extension>
+ <mime-type>application/vnd.amazon.ebook</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bat</extension>
+ <mime-type>application/x-msdownload</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bcpio</extension>
+ <mime-type>application/x-bcpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bdf</extension>
+ <mime-type>application/x-font-bdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bdm</extension>
+ <mime-type>application/vnd.syncml.dm+wbxml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bed</extension>
+ <mime-type>application/vnd.realvnc.bed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bh2</extension>
+ <mime-type>application/vnd.fujitsu.oasysprs</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bin</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>blb</extension>
+ <mime-type>application/x-blorb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>blorb</extension>
+ <mime-type>application/x-blorb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bmi</extension>
+ <mime-type>application/vnd.bmi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bmp</extension>
+ <mime-type>image/bmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>body</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>book</extension>
+ <mime-type>application/vnd.framemaker</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>box</extension>
+ <mime-type>application/vnd.previewsystems.box</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>boz</extension>
+ <mime-type>application/x-bzip2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bpk</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>btif</extension>
+ <mime-type>image/prs.btif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bz</extension>
+ <mime-type>application/x-bzip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bz2</extension>
+ <mime-type>application/x-bzip2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c</extension>
+ <mime-type>text/x-c</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c11amc</extension>
+ <mime-type>application/vnd.cluetrust.cartomobile-config</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c11amz</extension>
+ <mime-type>application/vnd.cluetrust.cartomobile-config-pkg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c4d</extension>
+ <mime-type>application/vnd.clonk.c4group</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c4f</extension>
+ <mime-type>application/vnd.clonk.c4group</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c4g</extension>
+ <mime-type>application/vnd.clonk.c4group</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c4p</extension>
+ <mime-type>application/vnd.clonk.c4group</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>c4u</extension>
+ <mime-type>application/vnd.clonk.c4group</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cab</extension>
+ <mime-type>application/vnd.ms-cab-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>caf</extension>
+ <mime-type>audio/x-caf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cap</extension>
+ <mime-type>application/vnd.tcpdump.pcap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>car</extension>
+ <mime-type>application/vnd.curl.car</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cat</extension>
+ <mime-type>application/vnd.ms-pki.seccat</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cb7</extension>
+ <mime-type>application/x-cbr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cba</extension>
+ <mime-type>application/x-cbr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cbr</extension>
+ <mime-type>application/x-cbr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cbt</extension>
+ <mime-type>application/x-cbr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cbz</extension>
+ <mime-type>application/x-cbr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cc</extension>
+ <mime-type>text/x-c</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cct</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ccxml</extension>
+ <mime-type>application/ccxml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdbcmsg</extension>
+ <mime-type>application/vnd.contact.cmsg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdf</extension>
+ <mime-type>application/x-cdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdkey</extension>
+ <mime-type>application/vnd.mediastation.cdkey</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdmia</extension>
+ <mime-type>application/cdmi-capability</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdmic</extension>
+ <mime-type>application/cdmi-container</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdmid</extension>
+ <mime-type>application/cdmi-domain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdmio</extension>
+ <mime-type>application/cdmi-object</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdmiq</extension>
+ <mime-type>application/cdmi-queue</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdx</extension>
+ <mime-type>chemical/x-cdx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdxml</extension>
+ <mime-type>application/vnd.chemdraw+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdy</extension>
+ <mime-type>application/vnd.cinderella</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cer</extension>
+ <mime-type>application/pkix-cert</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cfs</extension>
+ <mime-type>application/x-cfs-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cgm</extension>
+ <mime-type>image/cgm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>chat</extension>
+ <mime-type>application/x-chat</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>chm</extension>
+ <mime-type>application/vnd.ms-htmlhelp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>chrt</extension>
+ <mime-type>application/vnd.kde.kchart</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cif</extension>
+ <mime-type>chemical/x-cif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cii</extension>
+ <mime-type>application/vnd.anser-web-certificate-issue-initiation</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cil</extension>
+ <mime-type>application/vnd.ms-artgalry</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cla</extension>
+ <mime-type>application/vnd.claymore</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>class</extension>
+ <mime-type>application/java</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>clkk</extension>
+ <mime-type>application/vnd.crick.clicker.keyboard</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>clkp</extension>
+ <mime-type>application/vnd.crick.clicker.palette</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>clkt</extension>
+ <mime-type>application/vnd.crick.clicker.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>clkw</extension>
+ <mime-type>application/vnd.crick.clicker.wordbank</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>clkx</extension>
+ <mime-type>application/vnd.crick.clicker</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>clp</extension>
+ <mime-type>application/x-msclip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cmc</extension>
+ <mime-type>application/vnd.cosmocaller</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cmdf</extension>
+ <mime-type>chemical/x-cmdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cml</extension>
+ <mime-type>chemical/x-cml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cmp</extension>
+ <mime-type>application/vnd.yellowriver-custom-menu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cmx</extension>
+ <mime-type>image/x-cmx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cod</extension>
+ <mime-type>application/vnd.rim.cod</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>com</extension>
+ <mime-type>application/x-msdownload</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>conf</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cpio</extension>
+ <mime-type>application/x-cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cpp</extension>
+ <mime-type>text/x-c</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cpt</extension>
+ <mime-type>application/mac-compactpro</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>crd</extension>
+ <mime-type>application/x-mscardfile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>crl</extension>
+ <mime-type>application/pkix-crl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>crt</extension>
+ <mime-type>application/x-x509-ca-cert</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cryptonote</extension>
+ <mime-type>application/vnd.rig.cryptonote</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csh</extension>
+ <mime-type>application/x-csh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csml</extension>
+ <mime-type>chemical/x-csml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csp</extension>
+ <mime-type>application/vnd.commonspace</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>css</extension>
+ <mime-type>text/css</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cst</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csv</extension>
+ <mime-type>text/csv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cu</extension>
+ <mime-type>application/cu-seeme</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>curl</extension>
+ <mime-type>text/vnd.curl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cww</extension>
+ <mime-type>application/prs.cww</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cxt</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cxx</extension>
+ <mime-type>text/x-c</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dae</extension>
+ <mime-type>model/vnd.collada+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>daf</extension>
+ <mime-type>application/vnd.mobius.daf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dart</extension>
+ <mime-type>application/vnd.dart</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dataless</extension>
+ <mime-type>application/vnd.fdsn.seed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>davmount</extension>
+ <mime-type>application/davmount+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dbk</extension>
+ <mime-type>application/docbook+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dcr</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dcurl</extension>
+ <mime-type>text/vnd.curl.dcurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dd2</extension>
+ <mime-type>application/vnd.oma.dd2+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ddd</extension>
+ <mime-type>application/vnd.fujixerox.ddd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>deb</extension>
+ <mime-type>application/x-debian-package</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>def</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>deploy</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>der</extension>
+ <mime-type>application/x-x509-ca-cert</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dfac</extension>
+ <mime-type>application/vnd.dreamfactory</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dgc</extension>
+ <mime-type>application/x-dgc-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dib</extension>
+ <mime-type>image/bmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dic</extension>
+ <mime-type>text/x-c</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dir</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dis</extension>
+ <mime-type>application/vnd.mobius.dis</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dist</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>distz</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>djv</extension>
+ <mime-type>image/vnd.djvu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>djvu</extension>
+ <mime-type>image/vnd.djvu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dll</extension>
+ <mime-type>application/x-msdownload</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dmg</extension>
+ <mime-type>application/x-apple-diskimage</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dmp</extension>
+ <mime-type>application/vnd.tcpdump.pcap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dms</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dna</extension>
+ <mime-type>application/vnd.dna</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>doc</extension>
+ <mime-type>application/msword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>docm</extension>
+ <mime-type>application/vnd.ms-word.document.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>docx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dot</extension>
+ <mime-type>application/msword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dotm</extension>
+ <mime-type>application/vnd.ms-word.template.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dotx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dp</extension>
+ <mime-type>application/vnd.osgi.dp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dpg</extension>
+ <mime-type>application/vnd.dpgraph</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dra</extension>
+ <mime-type>audio/vnd.dra</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dsc</extension>
+ <mime-type>text/prs.lines.tag</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dssc</extension>
+ <mime-type>application/dssc+der</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dtb</extension>
+ <mime-type>application/x-dtbook+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dtd</extension>
+ <mime-type>application/xml-dtd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dts</extension>
+ <mime-type>audio/vnd.dts</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dtshd</extension>
+ <mime-type>audio/vnd.dts.hd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dump</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dv</extension>
+ <mime-type>video/x-dv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dvb</extension>
+ <mime-type>video/vnd.dvb.file</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dvi</extension>
+ <mime-type>application/x-dvi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dwf</extension>
+ <mime-type>model/vnd.dwf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dwg</extension>
+ <mime-type>image/vnd.dwg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dxf</extension>
+ <mime-type>image/vnd.dxf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dxp</extension>
+ <mime-type>application/vnd.spotfire.dxp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dxr</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ecelp4800</extension>
+ <mime-type>audio/vnd.nuera.ecelp4800</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ecelp7470</extension>
+ <mime-type>audio/vnd.nuera.ecelp7470</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ecelp9600</extension>
+ <mime-type>audio/vnd.nuera.ecelp9600</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ecma</extension>
+ <mime-type>application/ecmascript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>edm</extension>
+ <mime-type>application/vnd.novadigm.edm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>edx</extension>
+ <mime-type>application/vnd.novadigm.edx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>efif</extension>
+ <mime-type>application/vnd.picsel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ei6</extension>
+ <mime-type>application/vnd.pg.osasli</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>elc</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>emf</extension>
+ <mime-type>application/x-msmetafile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>eml</extension>
+ <mime-type>message/rfc822</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>emma</extension>
+ <mime-type>application/emma+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>emz</extension>
+ <mime-type>application/x-msmetafile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>eol</extension>
+ <mime-type>audio/vnd.digital-winds</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>eot</extension>
+ <mime-type>application/vnd.ms-fontobject</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>eps</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>epub</extension>
+ <mime-type>application/epub+zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>es3</extension>
+ <mime-type>application/vnd.eszigno3+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>esa</extension>
+ <mime-type>application/vnd.osgi.subsystem</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>esf</extension>
+ <mime-type>application/vnd.epson.esf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>et3</extension>
+ <mime-type>application/vnd.eszigno3+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>etx</extension>
+ <mime-type>text/x-setext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>eva</extension>
+ <mime-type>application/x-eva</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>evy</extension>
+ <mime-type>application/x-envoy</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>exe</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>exi</extension>
+ <mime-type>application/exi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ext</extension>
+ <mime-type>application/vnd.novadigm.ext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ez</extension>
+ <mime-type>application/andrew-inset</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ez2</extension>
+ <mime-type>application/vnd.ezpix-album</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ez3</extension>
+ <mime-type>application/vnd.ezpix-package</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>f</extension>
+ <mime-type>text/x-fortran</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>f4v</extension>
+ <mime-type>video/x-f4v</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>f77</extension>
+ <mime-type>text/x-fortran</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>f90</extension>
+ <mime-type>text/x-fortran</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fbs</extension>
+ <mime-type>image/vnd.fastbidsheet</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fcdt</extension>
+ <mime-type>application/vnd.adobe.formscentral.fcdt</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fcs</extension>
+ <mime-type>application/vnd.isac.fcs</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fdf</extension>
+ <mime-type>application/vnd.fdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fe_launch</extension>
+ <mime-type>application/vnd.denovo.fcselayout-link</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fg5</extension>
+ <mime-type>application/vnd.fujitsu.oasysgp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fgd</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fh</extension>
+ <mime-type>image/x-freehand</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fh4</extension>
+ <mime-type>image/x-freehand</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fh5</extension>
+ <mime-type>image/x-freehand</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fh7</extension>
+ <mime-type>image/x-freehand</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fhc</extension>
+ <mime-type>image/x-freehand</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fig</extension>
+ <mime-type>application/x-xfig</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>flac</extension>
+ <mime-type>audio/flac</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fli</extension>
+ <mime-type>video/x-fli</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>flo</extension>
+ <mime-type>application/vnd.micrografx.flo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>flv</extension>
+ <mime-type>video/x-flv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>flw</extension>
+ <mime-type>application/vnd.kde.kivio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>flx</extension>
+ <mime-type>text/vnd.fmi.flexstor</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fly</extension>
+ <mime-type>text/vnd.fly</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fm</extension>
+ <mime-type>application/vnd.framemaker</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fnc</extension>
+ <mime-type>application/vnd.frogans.fnc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>for</extension>
+ <mime-type>text/x-fortran</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fpx</extension>
+ <mime-type>image/vnd.fpx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>frame</extension>
+ <mime-type>application/vnd.framemaker</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fsc</extension>
+ <mime-type>application/vnd.fsc.weblaunch</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fst</extension>
+ <mime-type>image/vnd.fst</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ftc</extension>
+ <mime-type>application/vnd.fluxtime.clip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fti</extension>
+ <mime-type>application/vnd.anser-web-funds-transfer-initiation</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fvt</extension>
+ <mime-type>video/vnd.fvt</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fxp</extension>
+ <mime-type>application/vnd.adobe.fxp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fxpl</extension>
+ <mime-type>application/vnd.adobe.fxp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>fzs</extension>
+ <mime-type>application/vnd.fuzzysheet</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>g2w</extension>
+ <mime-type>application/vnd.geoplan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>g3</extension>
+ <mime-type>image/g3fax</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>g3w</extension>
+ <mime-type>application/vnd.geospace</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gac</extension>
+ <mime-type>application/vnd.groove-account</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gam</extension>
+ <mime-type>application/x-tads</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gbr</extension>
+ <mime-type>application/rpki-ghostbusters</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gca</extension>
+ <mime-type>application/x-gca-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gdl</extension>
+ <mime-type>model/vnd.gdl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>geo</extension>
+ <mime-type>application/vnd.dynageo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gex</extension>
+ <mime-type>application/vnd.geometry-explorer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ggb</extension>
+ <mime-type>application/vnd.geogebra.file</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ggt</extension>
+ <mime-type>application/vnd.geogebra.tool</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ghf</extension>
+ <mime-type>application/vnd.groove-help</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gif</extension>
+ <mime-type>image/gif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gim</extension>
+ <mime-type>application/vnd.groove-identity-message</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gml</extension>
+ <mime-type>application/gml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gmx</extension>
+ <mime-type>application/vnd.gmx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gnumeric</extension>
+ <mime-type>application/x-gnumeric</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gph</extension>
+ <mime-type>application/vnd.flographit</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gpx</extension>
+ <mime-type>application/gpx+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gqf</extension>
+ <mime-type>application/vnd.grafeq</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gqs</extension>
+ <mime-type>application/vnd.grafeq</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gram</extension>
+ <mime-type>application/srgs</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gramps</extension>
+ <mime-type>application/x-gramps-xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gre</extension>
+ <mime-type>application/vnd.geometry-explorer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>grv</extension>
+ <mime-type>application/vnd.groove-injector</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>grxml</extension>
+ <mime-type>application/srgs+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gsf</extension>
+ <mime-type>application/x-font-ghostscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gtar</extension>
+ <mime-type>application/x-gtar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gtm</extension>
+ <mime-type>application/vnd.groove-tool-message</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gtw</extension>
+ <mime-type>model/vnd.gtw</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gv</extension>
+ <mime-type>text/vnd.graphviz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gxf</extension>
+ <mime-type>application/gxf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gxt</extension>
+ <mime-type>application/vnd.geonext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gz</extension>
+ <mime-type>application/x-gzip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>h</extension>
+ <mime-type>text/x-c</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>h261</extension>
+ <mime-type>video/h261</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>h263</extension>
+ <mime-type>video/h263</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>h264</extension>
+ <mime-type>video/h264</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hal</extension>
+ <mime-type>application/vnd.hal+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hbci</extension>
+ <mime-type>application/vnd.hbci</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hdf</extension>
+ <mime-type>application/x-hdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hh</extension>
+ <mime-type>text/x-c</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hlp</extension>
+ <mime-type>application/winhlp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hpgl</extension>
+ <mime-type>application/vnd.hp-hpgl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hpid</extension>
+ <mime-type>application/vnd.hp-hpid</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hps</extension>
+ <mime-type>application/vnd.hp-hps</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hqx</extension>
+ <mime-type>application/mac-binhex40</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>htc</extension>
+ <mime-type>text/x-component</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>htke</extension>
+ <mime-type>application/vnd.kenameaapp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>htm</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>html</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hvd</extension>
+ <mime-type>application/vnd.yamaha.hv-dic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hvp</extension>
+ <mime-type>application/vnd.yamaha.hv-voice</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hvs</extension>
+ <mime-type>application/vnd.yamaha.hv-script</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>i2g</extension>
+ <mime-type>application/vnd.intergeo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>icc</extension>
+ <mime-type>application/vnd.iccprofile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ice</extension>
+ <mime-type>x-conference/x-cooltalk</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>icm</extension>
+ <mime-type>application/vnd.iccprofile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ico</extension>
+ <mime-type>image/x-icon</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ics</extension>
+ <mime-type>text/calendar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ief</extension>
+ <mime-type>image/ief</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ifb</extension>
+ <mime-type>text/calendar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ifm</extension>
+ <mime-type>application/vnd.shana.informed.formdata</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>iges</extension>
+ <mime-type>model/iges</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>igl</extension>
+ <mime-type>application/vnd.igloader</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>igm</extension>
+ <mime-type>application/vnd.insors.igm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>igs</extension>
+ <mime-type>model/iges</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>igx</extension>
+ <mime-type>application/vnd.micrografx.igx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>iif</extension>
+ <mime-type>application/vnd.shana.informed.interchange</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>imp</extension>
+ <mime-type>application/vnd.accpac.simply.imp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ims</extension>
+ <mime-type>application/vnd.ms-ims</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>in</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ink</extension>
+ <mime-type>application/inkml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>inkml</extension>
+ <mime-type>application/inkml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>install</extension>
+ <mime-type>application/x-install-instructions</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>iota</extension>
+ <mime-type>application/vnd.astraea-software.iota</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ipfix</extension>
+ <mime-type>application/ipfix</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ipk</extension>
+ <mime-type>application/vnd.shana.informed.package</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>irm</extension>
+ <mime-type>application/vnd.ibm.rights-management</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>irp</extension>
+ <mime-type>application/vnd.irepository.package+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>iso</extension>
+ <mime-type>application/x-iso9660-image</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>itp</extension>
+ <mime-type>application/vnd.shana.informed.formtemplate</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ivp</extension>
+ <mime-type>application/vnd.immervision-ivp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ivu</extension>
+ <mime-type>application/vnd.immervision-ivu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jad</extension>
+ <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jam</extension>
+ <mime-type>application/vnd.jam</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jar</extension>
+ <mime-type>application/java-archive</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>java</extension>
+ <mime-type>text/x-java-source</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jisp</extension>
+ <mime-type>application/vnd.jisp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jlt</extension>
+ <mime-type>application/vnd.hp-jlyt</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jnlp</extension>
+ <mime-type>application/x-java-jnlp-file</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>joda</extension>
+ <mime-type>application/vnd.joost.joda-archive</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpe</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpeg</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpg</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpgm</extension>
+ <mime-type>video/jpm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpgv</extension>
+ <mime-type>video/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpm</extension>
+ <mime-type>video/jpm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>js</extension>
+ <mime-type>application/javascript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jsf</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>json</extension>
+ <mime-type>application/json</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jsonml</extension>
+ <mime-type>application/jsonml+json</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jspf</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kar</extension>
+ <mime-type>audio/midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>karbon</extension>
+ <mime-type>application/vnd.kde.karbon</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kfo</extension>
+ <mime-type>application/vnd.kde.kformula</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kia</extension>
+ <mime-type>application/vnd.kidspiration</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kml</extension>
+ <mime-type>application/vnd.google-earth.kml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kmz</extension>
+ <mime-type>application/vnd.google-earth.kmz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kne</extension>
+ <mime-type>application/vnd.kinar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>knp</extension>
+ <mime-type>application/vnd.kinar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kon</extension>
+ <mime-type>application/vnd.kde.kontour</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kpr</extension>
+ <mime-type>application/vnd.kde.kpresenter</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kpt</extension>
+ <mime-type>application/vnd.kde.kpresenter</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kpxx</extension>
+ <mime-type>application/vnd.ds-keypoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ksp</extension>
+ <mime-type>application/vnd.kde.kspread</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ktr</extension>
+ <mime-type>application/vnd.kahootz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ktx</extension>
+ <mime-type>image/ktx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ktz</extension>
+ <mime-type>application/vnd.kahootz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kwd</extension>
+ <mime-type>application/vnd.kde.kword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kwt</extension>
+ <mime-type>application/vnd.kde.kword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lasxml</extension>
+ <mime-type>application/vnd.las.las+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>latex</extension>
+ <mime-type>application/x-latex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lbd</extension>
+ <mime-type>application/vnd.llamagraphics.life-balance.desktop</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lbe</extension>
+ <mime-type>application/vnd.llamagraphics.life-balance.exchange+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>les</extension>
+ <mime-type>application/vnd.hhe.lesson-player</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lha</extension>
+ <mime-type>application/x-lzh-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>link66</extension>
+ <mime-type>application/vnd.route66.link66+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>list</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>list3820</extension>
+ <mime-type>application/vnd.ibm.modcap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>listafp</extension>
+ <mime-type>application/vnd.ibm.modcap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lnk</extension>
+ <mime-type>application/x-ms-shortcut</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>log</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lostxml</extension>
+ <mime-type>application/lost+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lrf</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lrm</extension>
+ <mime-type>application/vnd.ms-lrm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ltf</extension>
+ <mime-type>application/vnd.frogans.ltf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lvp</extension>
+ <mime-type>audio/vnd.lucent.voice</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lwp</extension>
+ <mime-type>application/vnd.lotus-wordpro</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>lzh</extension>
+ <mime-type>application/x-lzh-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m13</extension>
+ <mime-type>application/x-msmediaview</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m14</extension>
+ <mime-type>application/x-msmediaview</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m1v</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m21</extension>
+ <mime-type>application/mp21</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m2a</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m2v</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m3a</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m3u</extension>
+ <mime-type>audio/x-mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m3u8</extension>
+ <mime-type>application/vnd.apple.mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m4a</extension>
+ <mime-type>audio/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m4b</extension>
+ <mime-type>audio/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m4r</extension>
+ <mime-type>audio/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m4u</extension>
+ <mime-type>video/vnd.mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m4v</extension>
+ <mime-type>video/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ma</extension>
+ <mime-type>application/mathematica</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mac</extension>
+ <mime-type>image/x-macpaint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mads</extension>
+ <mime-type>application/mads+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mag</extension>
+ <mime-type>application/vnd.ecowin.chart</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>maker</extension>
+ <mime-type>application/vnd.framemaker</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>man</extension>
+ <mime-type>text/troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mar</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mathml</extension>
+ <mime-type>application/mathml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mb</extension>
+ <mime-type>application/mathematica</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mbk</extension>
+ <mime-type>application/vnd.mobius.mbk</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mbox</extension>
+ <mime-type>application/mbox</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mc1</extension>
+ <mime-type>application/vnd.medcalcdata</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mcd</extension>
+ <mime-type>application/vnd.mcd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mcurl</extension>
+ <mime-type>text/vnd.curl.mcurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mdb</extension>
+ <mime-type>application/x-msaccess</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mdi</extension>
+ <mime-type>image/vnd.ms-modi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>me</extension>
+ <mime-type>text/troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mesh</extension>
+ <mime-type>model/mesh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>meta4</extension>
+ <mime-type>application/metalink4+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>metalink</extension>
+ <mime-type>application/metalink+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mets</extension>
+ <mime-type>application/mets+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mfm</extension>
+ <mime-type>application/vnd.mfmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mft</extension>
+ <mime-type>application/rpki-manifest</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mgp</extension>
+ <mime-type>application/vnd.osgeo.mapguide.package</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mgz</extension>
+ <mime-type>application/vnd.proteus.magazine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mid</extension>
+ <mime-type>audio/midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>midi</extension>
+ <mime-type>audio/midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mie</extension>
+ <mime-type>application/x-mie</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mif</extension>
+ <mime-type>application/x-mif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mime</extension>
+ <mime-type>message/rfc822</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mj2</extension>
+ <mime-type>video/mj2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mjp2</extension>
+ <mime-type>video/mj2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mk3d</extension>
+ <mime-type>video/x-matroska</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mka</extension>
+ <mime-type>audio/x-matroska</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mks</extension>
+ <mime-type>video/x-matroska</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mkv</extension>
+ <mime-type>video/x-matroska</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mlp</extension>
+ <mime-type>application/vnd.dolby.mlp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mmd</extension>
+ <mime-type>application/vnd.chipnuts.karaoke-mmd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mmf</extension>
+ <mime-type>application/vnd.smaf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mmr</extension>
+ <mime-type>image/vnd.fujixerox.edmics-mmr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mng</extension>
+ <mime-type>video/x-mng</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mny</extension>
+ <mime-type>application/x-msmoney</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mobi</extension>
+ <mime-type>application/x-mobipocket-ebook</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mods</extension>
+ <mime-type>application/mods+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mov</extension>
+ <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>movie</extension>
+ <mime-type>video/x-sgi-movie</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp1</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp2</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp21</extension>
+ <mime-type>application/mp21</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp2a</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp3</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp4</extension>
+ <mime-type>video/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp4a</extension>
+ <mime-type>audio/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp4s</extension>
+ <mime-type>application/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp4v</extension>
+ <mime-type>video/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpa</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpc</extension>
+ <mime-type>application/vnd.mophun.certificate</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpe</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpeg</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpega</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpg</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpg4</extension>
+ <mime-type>video/mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpga</extension>
+ <mime-type>audio/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpkg</extension>
+ <mime-type>application/vnd.apple.installer+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpm</extension>
+ <mime-type>application/vnd.blueice.multipass</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpn</extension>
+ <mime-type>application/vnd.mophun.application</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpp</extension>
+ <mime-type>application/vnd.ms-project</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpt</extension>
+ <mime-type>application/vnd.ms-project</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpv2</extension>
+ <mime-type>video/mpeg2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpy</extension>
+ <mime-type>application/vnd.ibm.minipay</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mqy</extension>
+ <mime-type>application/vnd.mobius.mqy</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mrc</extension>
+ <mime-type>application/marc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mrcx</extension>
+ <mime-type>application/marcxml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ms</extension>
+ <mime-type>text/troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mscml</extension>
+ <mime-type>application/mediaservercontrol+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mseed</extension>
+ <mime-type>application/vnd.fdsn.mseed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mseq</extension>
+ <mime-type>application/vnd.mseq</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>msf</extension>
+ <mime-type>application/vnd.epson.msf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>msh</extension>
+ <mime-type>model/mesh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>msi</extension>
+ <mime-type>application/x-msdownload</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>msl</extension>
+ <mime-type>application/vnd.mobius.msl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>msty</extension>
+ <mime-type>application/vnd.muvee.style</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mts</extension>
+ <mime-type>model/vnd.mts</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mus</extension>
+ <mime-type>application/vnd.musician</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>musicxml</extension>
+ <mime-type>application/vnd.recordare.musicxml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mvb</extension>
+ <mime-type>application/x-msmediaview</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mwf</extension>
+ <mime-type>application/vnd.mfer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mxf</extension>
+ <mime-type>application/mxf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mxl</extension>
+ <mime-type>application/vnd.recordare.musicxml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mxml</extension>
+ <mime-type>application/xv+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mxs</extension>
+ <mime-type>application/vnd.triscape.mxs</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mxu</extension>
+ <mime-type>video/vnd.mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>n-gage</extension>
+ <mime-type>application/vnd.nokia.n-gage.symbian.install</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>n3</extension>
+ <mime-type>text/n3</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nb</extension>
+ <mime-type>application/mathematica</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nbp</extension>
+ <mime-type>application/vnd.wolfram.player</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nc</extension>
+ <mime-type>application/x-netcdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ncx</extension>
+ <mime-type>application/x-dtbncx+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nfo</extension>
+ <mime-type>text/x-nfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ngdat</extension>
+ <mime-type>application/vnd.nokia.n-gage.data</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nitf</extension>
+ <mime-type>application/vnd.nitf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nlu</extension>
+ <mime-type>application/vnd.neurolanguage.nlu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nml</extension>
+ <mime-type>application/vnd.enliven</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nnd</extension>
+ <mime-type>application/vnd.noblenet-directory</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nns</extension>
+ <mime-type>application/vnd.noblenet-sealer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nnw</extension>
+ <mime-type>application/vnd.noblenet-web</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>npx</extension>
+ <mime-type>image/vnd.net-fpx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nsc</extension>
+ <mime-type>application/x-conference</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nsf</extension>
+ <mime-type>application/vnd.lotus-notes</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ntf</extension>
+ <mime-type>application/vnd.nitf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nzb</extension>
+ <mime-type>application/x-nzb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oa2</extension>
+ <mime-type>application/vnd.fujitsu.oasys2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oa3</extension>
+ <mime-type>application/vnd.fujitsu.oasys3</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oas</extension>
+ <mime-type>application/vnd.fujitsu.oasys</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>obd</extension>
+ <mime-type>application/x-msbinder</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>obj</extension>
+ <mime-type>application/x-tgif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oda</extension>
+ <mime-type>application/oda</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Database -->
+ <extension>odb</extension>
+ <mime-type>application/vnd.oasis.opendocument.database</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Chart -->
+ <extension>odc</extension>
+ <mime-type>application/vnd.oasis.opendocument.chart</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Formula -->
+ <extension>odf</extension>
+ <mime-type>application/vnd.oasis.opendocument.formula</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>odft</extension>
+ <mime-type>application/vnd.oasis.opendocument.formula-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Drawing -->
+ <extension>odg</extension>
+ <mime-type>application/vnd.oasis.opendocument.graphics</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Image -->
+ <extension>odi</extension>
+ <mime-type>application/vnd.oasis.opendocument.image</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Master Document -->
+ <extension>odm</extension>
+ <mime-type>application/vnd.oasis.opendocument.text-master</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Presentation -->
+ <extension>odp</extension>
+ <mime-type>application/vnd.oasis.opendocument.presentation</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Spreadsheet -->
+ <extension>ods</extension>
+ <mime-type>application/vnd.oasis.opendocument.spreadsheet</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Text -->
+ <extension>odt</extension>
+ <mime-type>application/vnd.oasis.opendocument.text</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oga</extension>
+ <mime-type>audio/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ogg</extension>
+ <mime-type>audio/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ogv</extension>
+ <mime-type>video/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- xiph mime types -->
+ <extension>ogx</extension>
+ <mime-type>application/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>omdoc</extension>
+ <mime-type>application/omdoc+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>onepkg</extension>
+ <mime-type>application/onenote</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>onetmp</extension>
+ <mime-type>application/onenote</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>onetoc</extension>
+ <mime-type>application/onenote</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>onetoc2</extension>
+ <mime-type>application/onenote</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>opf</extension>
+ <mime-type>application/oebps-package+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>opml</extension>
+ <mime-type>text/x-opml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oprc</extension>
+ <mime-type>application/vnd.palm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>org</extension>
+ <mime-type>application/vnd.lotus-organizer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>osf</extension>
+ <mime-type>application/vnd.yamaha.openscoreformat</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>osfpvg</extension>
+ <mime-type>application/vnd.yamaha.openscoreformat.osfpvg+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>otc</extension>
+ <mime-type>application/vnd.oasis.opendocument.chart-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>otf</extension>
+ <mime-type>application/x-font-otf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Drawing Template -->
+ <extension>otg</extension>
+ <mime-type>application/vnd.oasis.opendocument.graphics-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- HTML Document Template -->
+ <extension>oth</extension>
+ <mime-type>application/vnd.oasis.opendocument.text-web</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oti</extension>
+ <mime-type>application/vnd.oasis.opendocument.image-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Presentation Template -->
+ <extension>otp</extension>
+ <mime-type>application/vnd.oasis.opendocument.presentation-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Spreadsheet Template -->
+ <extension>ots</extension>
+ <mime-type>application/vnd.oasis.opendocument.spreadsheet-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- OpenDocument Text Template -->
+ <extension>ott</extension>
+ <mime-type>application/vnd.oasis.opendocument.text-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oxps</extension>
+ <mime-type>application/oxps</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oxt</extension>
+ <mime-type>application/vnd.openofficeorg.extension</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p</extension>
+ <mime-type>text/x-pascal</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p10</extension>
+ <mime-type>application/pkcs10</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p12</extension>
+ <mime-type>application/x-pkcs12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p7b</extension>
+ <mime-type>application/x-pkcs7-certificates</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p7c</extension>
+ <mime-type>application/pkcs7-mime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p7m</extension>
+ <mime-type>application/pkcs7-mime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p7r</extension>
+ <mime-type>application/x-pkcs7-certreqresp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p7s</extension>
+ <mime-type>application/pkcs7-signature</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>p8</extension>
+ <mime-type>application/pkcs8</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pas</extension>
+ <mime-type>text/x-pascal</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>paw</extension>
+ <mime-type>application/vnd.pawaafile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pbd</extension>
+ <mime-type>application/vnd.powerbuilder6</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pbm</extension>
+ <mime-type>image/x-portable-bitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pcap</extension>
+ <mime-type>application/vnd.tcpdump.pcap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pcf</extension>
+ <mime-type>application/x-font-pcf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pcl</extension>
+ <mime-type>application/vnd.hp-pcl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pclxl</extension>
+ <mime-type>application/vnd.hp-pclxl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pct</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pcurl</extension>
+ <mime-type>application/vnd.curl.pcurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pcx</extension>
+ <mime-type>image/x-pcx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pdb</extension>
+ <mime-type>application/vnd.palm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pdf</extension>
+ <mime-type>application/pdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pfa</extension>
+ <mime-type>application/x-font-type1</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pfb</extension>
+ <mime-type>application/x-font-type1</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pfm</extension>
+ <mime-type>application/x-font-type1</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pfr</extension>
+ <mime-type>application/font-tdpfr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pfx</extension>
+ <mime-type>application/x-pkcs12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pgm</extension>
+ <mime-type>image/x-portable-graymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pgn</extension>
+ <mime-type>application/x-chess-pgn</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pgp</extension>
+ <mime-type>application/pgp-encrypted</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pic</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pict</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pkg</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pki</extension>
+ <mime-type>application/pkixcmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pkipath</extension>
+ <mime-type>application/pkix-pkipath</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>plb</extension>
+ <mime-type>application/vnd.3gpp.pic-bw-large</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>plc</extension>
+ <mime-type>application/vnd.mobius.plc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>plf</extension>
+ <mime-type>application/vnd.pocketlearn</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pls</extension>
+ <mime-type>audio/x-scpls</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pml</extension>
+ <mime-type>application/vnd.ctc-posml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>png</extension>
+ <mime-type>image/png</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pnm</extension>
+ <mime-type>image/x-portable-anymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pnt</extension>
+ <mime-type>image/x-macpaint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>portpkg</extension>
+ <mime-type>application/vnd.macports.portpkg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pot</extension>
+ <mime-type>application/vnd.ms-powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>potm</extension>
+ <mime-type>application/vnd.ms-powerpoint.template.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>potx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.presentationml.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppam</extension>
+ <mime-type>application/vnd.ms-powerpoint.addin.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppd</extension>
+ <mime-type>application/vnd.cups-ppd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppm</extension>
+ <mime-type>image/x-portable-pixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pps</extension>
+ <mime-type>application/vnd.ms-powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppsm</extension>
+ <mime-type>application/vnd.ms-powerpoint.slideshow.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppsx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.presentationml.slideshow</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppt</extension>
+ <mime-type>application/vnd.ms-powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pptm</extension>
+ <mime-type>application/vnd.ms-powerpoint.presentation.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pptx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.presentationml.presentation</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pqa</extension>
+ <mime-type>application/vnd.palm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>prc</extension>
+ <mime-type>application/x-mobipocket-ebook</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pre</extension>
+ <mime-type>application/vnd.lotus-freelance</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>prf</extension>
+ <mime-type>application/pics-rules</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ps</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>psb</extension>
+ <mime-type>application/vnd.3gpp.pic-bw-small</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>psd</extension>
+ <mime-type>image/vnd.adobe.photoshop</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>psf</extension>
+ <mime-type>application/x-font-linux-psf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pskcxml</extension>
+ <mime-type>application/pskc+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ptid</extension>
+ <mime-type>application/vnd.pvi.ptid1</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pub</extension>
+ <mime-type>application/x-mspublisher</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pvb</extension>
+ <mime-type>application/vnd.3gpp.pic-bw-var</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pwn</extension>
+ <mime-type>application/vnd.3m.post-it-notes</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pya</extension>
+ <mime-type>audio/vnd.ms-playready.media.pya</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pyv</extension>
+ <mime-type>video/vnd.ms-playready.media.pyv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qam</extension>
+ <mime-type>application/vnd.epson.quickanime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qbo</extension>
+ <mime-type>application/vnd.intu.qbo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qfx</extension>
+ <mime-type>application/vnd.intu.qfx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qps</extension>
+ <mime-type>application/vnd.publishare-delta-tree</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qt</extension>
+ <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qti</extension>
+ <mime-type>image/x-quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qtif</extension>
+ <mime-type>image/x-quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qwd</extension>
+ <mime-type>application/vnd.quark.quarkxpress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qwt</extension>
+ <mime-type>application/vnd.quark.quarkxpress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qxb</extension>
+ <mime-type>application/vnd.quark.quarkxpress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qxd</extension>
+ <mime-type>application/vnd.quark.quarkxpress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qxl</extension>
+ <mime-type>application/vnd.quark.quarkxpress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qxt</extension>
+ <mime-type>application/vnd.quark.quarkxpress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ra</extension>
+ <mime-type>audio/x-pn-realaudio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ram</extension>
+ <mime-type>audio/x-pn-realaudio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rar</extension>
+ <mime-type>application/x-rar-compressed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ras</extension>
+ <mime-type>image/x-cmu-raster</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rcprofile</extension>
+ <mime-type>application/vnd.ipunplugged.rcprofile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rdf</extension>
+ <mime-type>application/rdf+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rdz</extension>
+ <mime-type>application/vnd.data-vision.rdz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rep</extension>
+ <mime-type>application/vnd.businessobjects</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>res</extension>
+ <mime-type>application/x-dtbresource+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rgb</extension>
+ <mime-type>image/x-rgb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rif</extension>
+ <mime-type>application/reginfo+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rip</extension>
+ <mime-type>audio/vnd.rip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ris</extension>
+ <mime-type>application/x-research-info-systems</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rl</extension>
+ <mime-type>application/resource-lists+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rlc</extension>
+ <mime-type>image/vnd.fujixerox.edmics-rlc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rld</extension>
+ <mime-type>application/resource-lists-diff+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rm</extension>
+ <mime-type>application/vnd.rn-realmedia</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rmi</extension>
+ <mime-type>audio/midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rmp</extension>
+ <mime-type>audio/x-pn-realaudio-plugin</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rms</extension>
+ <mime-type>application/vnd.jcp.javame.midlet-rms</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rmvb</extension>
+ <mime-type>application/vnd.rn-realmedia-vbr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rnc</extension>
+ <mime-type>application/relax-ng-compact-syntax</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>roa</extension>
+ <mime-type>application/rpki-roa</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>roff</extension>
+ <mime-type>text/troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rp9</extension>
+ <mime-type>application/vnd.cloanto.rp9</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rpss</extension>
+ <mime-type>application/vnd.nokia.radio-presets</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rpst</extension>
+ <mime-type>application/vnd.nokia.radio-preset</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rq</extension>
+ <mime-type>application/sparql-query</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rs</extension>
+ <mime-type>application/rls-services+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rsd</extension>
+ <mime-type>application/rsd+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rss</extension>
+ <mime-type>application/rss+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rtf</extension>
+ <mime-type>application/rtf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rtx</extension>
+ <mime-type>text/richtext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>s</extension>
+ <mime-type>text/x-asm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>s3m</extension>
+ <mime-type>audio/s3m</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>saf</extension>
+ <mime-type>application/vnd.yamaha.smaf-audio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sbml</extension>
+ <mime-type>application/sbml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sc</extension>
+ <mime-type>application/vnd.ibm.secure-container</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>scd</extension>
+ <mime-type>application/x-msschedule</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>scm</extension>
+ <mime-type>application/vnd.lotus-screencam</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>scq</extension>
+ <mime-type>application/scvp-cv-request</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>scs</extension>
+ <mime-type>application/scvp-cv-response</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>scurl</extension>
+ <mime-type>text/vnd.curl.scurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sda</extension>
+ <mime-type>application/vnd.stardivision.draw</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sdc</extension>
+ <mime-type>application/vnd.stardivision.calc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sdd</extension>
+ <mime-type>application/vnd.stardivision.impress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sdkd</extension>
+ <mime-type>application/vnd.solent.sdkm+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sdkm</extension>
+ <mime-type>application/vnd.solent.sdkm+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sdp</extension>
+ <mime-type>application/sdp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sdw</extension>
+ <mime-type>application/vnd.stardivision.writer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>see</extension>
+ <mime-type>application/vnd.seemail</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>seed</extension>
+ <mime-type>application/vnd.fdsn.seed</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sema</extension>
+ <mime-type>application/vnd.sema</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>semd</extension>
+ <mime-type>application/vnd.semd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>semf</extension>
+ <mime-type>application/vnd.semf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ser</extension>
+ <mime-type>application/java-serialized-object</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>setpay</extension>
+ <mime-type>application/set-payment-initiation</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>setreg</extension>
+ <mime-type>application/set-registration-initiation</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sfd-hdstx</extension>
+ <mime-type>application/vnd.hydrostatix.sof-data</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sfs</extension>
+ <mime-type>application/vnd.spotfire.sfs</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sfv</extension>
+ <mime-type>text/x-sfv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sgi</extension>
+ <mime-type>image/sgi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sgl</extension>
+ <mime-type>application/vnd.stardivision.writer-global</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sgm</extension>
+ <mime-type>text/sgml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sgml</extension>
+ <mime-type>text/sgml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sh</extension>
+ <mime-type>application/x-sh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>shar</extension>
+ <mime-type>application/x-shar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>shf</extension>
+ <mime-type>application/shf+xml</mime-type>
+ </mime-mapping>
+ <!--
+ <mime-mapping>
+ <extension>shtml</extension>
+ <mime-type>text/x-server-parsed-html</mime-type>
+ </mime-mapping>
+ -->
+ <mime-mapping>
+ <extension>sid</extension>
+ <mime-type>image/x-mrsid-image</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sig</extension>
+ <mime-type>application/pgp-signature</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sil</extension>
+ <mime-type>audio/silk</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>silo</extension>
+ <mime-type>model/mesh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sis</extension>
+ <mime-type>application/vnd.symbian.install</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sisx</extension>
+ <mime-type>application/vnd.symbian.install</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sit</extension>
+ <mime-type>application/x-stuffit</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sitx</extension>
+ <mime-type>application/x-stuffitx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>skd</extension>
+ <mime-type>application/vnd.koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>skm</extension>
+ <mime-type>application/vnd.koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>skp</extension>
+ <mime-type>application/vnd.koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>skt</extension>
+ <mime-type>application/vnd.koan</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sldm</extension>
+ <mime-type>application/vnd.ms-powerpoint.slide.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sldx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.presentationml.slide</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>slt</extension>
+ <mime-type>application/vnd.epson.salt</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sm</extension>
+ <mime-type>application/vnd.stepmania.stepchart</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>smf</extension>
+ <mime-type>application/vnd.stardivision.math</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>smi</extension>
+ <mime-type>application/smil+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>smil</extension>
+ <mime-type>application/smil+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>smv</extension>
+ <mime-type>video/x-smv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>smzip</extension>
+ <mime-type>application/vnd.stepmania.package</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>snd</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>snf</extension>
+ <mime-type>application/x-font-snf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>so</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spc</extension>
+ <mime-type>application/x-pkcs7-certificates</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spf</extension>
+ <mime-type>application/vnd.yamaha.smaf-phrase</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spl</extension>
+ <mime-type>application/x-futuresplash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spot</extension>
+ <mime-type>text/vnd.in3d.spot</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spp</extension>
+ <mime-type>application/scvp-vp-response</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spq</extension>
+ <mime-type>application/scvp-vp-request</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>spx</extension>
+ <mime-type>audio/ogg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sql</extension>
+ <mime-type>application/x-sql</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>src</extension>
+ <mime-type>application/x-wais-source</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>srt</extension>
+ <mime-type>application/x-subrip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sru</extension>
+ <mime-type>application/sru+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>srx</extension>
+ <mime-type>application/sparql-results+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ssdl</extension>
+ <mime-type>application/ssdl+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sse</extension>
+ <mime-type>application/vnd.kodak-descriptor</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ssf</extension>
+ <mime-type>application/vnd.epson.ssf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ssml</extension>
+ <mime-type>application/ssml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>st</extension>
+ <mime-type>application/vnd.sailingtracker.track</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>stc</extension>
+ <mime-type>application/vnd.sun.xml.calc.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>std</extension>
+ <mime-type>application/vnd.sun.xml.draw.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>stf</extension>
+ <mime-type>application/vnd.wt.stf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sti</extension>
+ <mime-type>application/vnd.sun.xml.impress.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>stk</extension>
+ <mime-type>application/hyperstudio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>stl</extension>
+ <mime-type>application/vnd.ms-pki.stl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>str</extension>
+ <mime-type>application/vnd.pg.format</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>stw</extension>
+ <mime-type>application/vnd.sun.xml.writer.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sub</extension>
+ <mime-type>text/vnd.dvb.subtitle</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sus</extension>
+ <mime-type>application/vnd.sus-calendar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>susp</extension>
+ <mime-type>application/vnd.sus-calendar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sv4cpio</extension>
+ <mime-type>application/x-sv4cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sv4crc</extension>
+ <mime-type>application/x-sv4crc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svc</extension>
+ <mime-type>application/vnd.dvb.service</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svd</extension>
+ <mime-type>application/vnd.svd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svg</extension>
+ <mime-type>image/svg+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svgz</extension>
+ <mime-type>image/svg+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>swa</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>swf</extension>
+ <mime-type>application/x-shockwave-flash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>swi</extension>
+ <mime-type>application/vnd.aristanetworks.swi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sxc</extension>
+ <mime-type>application/vnd.sun.xml.calc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sxd</extension>
+ <mime-type>application/vnd.sun.xml.draw</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sxg</extension>
+ <mime-type>application/vnd.sun.xml.writer.global</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sxi</extension>
+ <mime-type>application/vnd.sun.xml.impress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sxm</extension>
+ <mime-type>application/vnd.sun.xml.math</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sxw</extension>
+ <mime-type>application/vnd.sun.xml.writer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>t</extension>
+ <mime-type>text/troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>t3</extension>
+ <mime-type>application/x-t3vm-image</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>taglet</extension>
+ <mime-type>application/vnd.mynfc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tao</extension>
+ <mime-type>application/vnd.tao.intent-module-archive</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tar</extension>
+ <mime-type>application/x-tar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tcap</extension>
+ <mime-type>application/vnd.3gpp2.tcap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tcl</extension>
+ <mime-type>application/x-tcl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>teacher</extension>
+ <mime-type>application/vnd.smart.teacher</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tei</extension>
+ <mime-type>application/tei+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>teicorpus</extension>
+ <mime-type>application/tei+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tex</extension>
+ <mime-type>application/x-tex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>texi</extension>
+ <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>texinfo</extension>
+ <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>text</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tfi</extension>
+ <mime-type>application/thraud+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tfm</extension>
+ <mime-type>application/x-tex-tfm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tga</extension>
+ <mime-type>image/x-tga</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>thmx</extension>
+ <mime-type>application/vnd.ms-officetheme</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tif</extension>
+ <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tiff</extension>
+ <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tmo</extension>
+ <mime-type>application/vnd.tmobile-livetv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>torrent</extension>
+ <mime-type>application/x-bittorrent</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tpl</extension>
+ <mime-type>application/vnd.groove-tool-template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tpt</extension>
+ <mime-type>application/vnd.trid.tpt</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tr</extension>
+ <mime-type>text/troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tra</extension>
+ <mime-type>application/vnd.trueapp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>trm</extension>
+ <mime-type>application/x-msterminal</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tsd</extension>
+ <mime-type>application/timestamped-data</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tsv</extension>
+ <mime-type>text/tab-separated-values</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ttc</extension>
+ <mime-type>application/x-font-ttf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ttf</extension>
+ <mime-type>application/x-font-ttf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ttl</extension>
+ <mime-type>text/turtle</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>twd</extension>
+ <mime-type>application/vnd.simtech-mindmapper</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>twds</extension>
+ <mime-type>application/vnd.simtech-mindmapper</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>txd</extension>
+ <mime-type>application/vnd.genomatix.tuxedo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>txf</extension>
+ <mime-type>application/vnd.mobius.txf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>txt</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>u32</extension>
+ <mime-type>application/x-authorware-bin</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>udeb</extension>
+ <mime-type>application/x-debian-package</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ufd</extension>
+ <mime-type>application/vnd.ufdl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ufdl</extension>
+ <mime-type>application/vnd.ufdl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ulw</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ulx</extension>
+ <mime-type>application/x-glulx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>umj</extension>
+ <mime-type>application/vnd.umajin</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>unityweb</extension>
+ <mime-type>application/vnd.unity</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uoml</extension>
+ <mime-type>application/vnd.uoml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uri</extension>
+ <mime-type>text/uri-list</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uris</extension>
+ <mime-type>text/uri-list</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>urls</extension>
+ <mime-type>text/uri-list</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ustar</extension>
+ <mime-type>application/x-ustar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>utz</extension>
+ <mime-type>application/vnd.uiq.theme</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uu</extension>
+ <mime-type>text/x-uuencode</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uva</extension>
+ <mime-type>audio/vnd.dece.audio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvd</extension>
+ <mime-type>application/vnd.dece.data</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvf</extension>
+ <mime-type>application/vnd.dece.data</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvg</extension>
+ <mime-type>image/vnd.dece.graphic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvh</extension>
+ <mime-type>video/vnd.dece.hd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvi</extension>
+ <mime-type>image/vnd.dece.graphic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvm</extension>
+ <mime-type>video/vnd.dece.mobile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvp</extension>
+ <mime-type>video/vnd.dece.pd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvs</extension>
+ <mime-type>video/vnd.dece.sd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvt</extension>
+ <mime-type>application/vnd.dece.ttml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvu</extension>
+ <mime-type>video/vnd.uvvu.mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvv</extension>
+ <mime-type>video/vnd.dece.video</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvva</extension>
+ <mime-type>audio/vnd.dece.audio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvd</extension>
+ <mime-type>application/vnd.dece.data</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvf</extension>
+ <mime-type>application/vnd.dece.data</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvg</extension>
+ <mime-type>image/vnd.dece.graphic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvh</extension>
+ <mime-type>video/vnd.dece.hd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvi</extension>
+ <mime-type>image/vnd.dece.graphic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvm</extension>
+ <mime-type>video/vnd.dece.mobile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvp</extension>
+ <mime-type>video/vnd.dece.pd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvs</extension>
+ <mime-type>video/vnd.dece.sd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvt</extension>
+ <mime-type>application/vnd.dece.ttml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvu</extension>
+ <mime-type>video/vnd.uvvu.mp4</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvv</extension>
+ <mime-type>video/vnd.dece.video</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvx</extension>
+ <mime-type>application/vnd.dece.unspecified</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvvz</extension>
+ <mime-type>application/vnd.dece.zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvx</extension>
+ <mime-type>application/vnd.dece.unspecified</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>uvz</extension>
+ <mime-type>application/vnd.dece.zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vcard</extension>
+ <mime-type>text/vcard</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vcd</extension>
+ <mime-type>application/x-cdlink</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vcf</extension>
+ <mime-type>text/x-vcard</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vcg</extension>
+ <mime-type>application/vnd.groove-vcard</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vcs</extension>
+ <mime-type>text/x-vcalendar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vcx</extension>
+ <mime-type>application/vnd.vcx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vis</extension>
+ <mime-type>application/vnd.visionary</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>viv</extension>
+ <mime-type>video/vnd.vivo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vob</extension>
+ <mime-type>video/x-ms-vob</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vor</extension>
+ <mime-type>application/vnd.stardivision.writer</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vox</extension>
+ <mime-type>application/x-authorware-bin</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vrml</extension>
+ <mime-type>model/vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vsd</extension>
+ <mime-type>application/vnd.visio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vsf</extension>
+ <mime-type>application/vnd.vsf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vss</extension>
+ <mime-type>application/vnd.visio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vst</extension>
+ <mime-type>application/vnd.visio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vsw</extension>
+ <mime-type>application/vnd.visio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vtu</extension>
+ <mime-type>model/vnd.vtu</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vxml</extension>
+ <mime-type>application/voicexml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>w3d</extension>
+ <mime-type>application/x-director</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wad</extension>
+ <mime-type>application/x-doom</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wav</extension>
+ <mime-type>audio/x-wav</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wax</extension>
+ <mime-type>audio/x-ms-wax</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Wireless Bitmap -->
+ <extension>wbmp</extension>
+ <mime-type>image/vnd.wap.wbmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wbs</extension>
+ <mime-type>application/vnd.criticaltools.wbs+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wbxml</extension>
+ <mime-type>application/vnd.wap.wbxml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wcm</extension>
+ <mime-type>application/vnd.ms-works</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wdb</extension>
+ <mime-type>application/vnd.ms-works</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wdp</extension>
+ <mime-type>image/vnd.ms-photo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>weba</extension>
+ <mime-type>audio/webm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>webm</extension>
+ <mime-type>video/webm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>webp</extension>
+ <mime-type>image/webp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wg</extension>
+ <mime-type>application/vnd.pmi.widget</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wgt</extension>
+ <mime-type>application/widget</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wks</extension>
+ <mime-type>application/vnd.ms-works</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wm</extension>
+ <mime-type>video/x-ms-wm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wma</extension>
+ <mime-type>audio/x-ms-wma</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wmd</extension>
+ <mime-type>application/x-ms-wmd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wmf</extension>
+ <mime-type>application/x-msmetafile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- WML Source -->
+ <extension>wml</extension>
+ <mime-type>text/vnd.wap.wml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Compiled WML -->
+ <extension>wmlc</extension>
+ <mime-type>application/vnd.wap.wmlc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- WML Script Source -->
+ <extension>wmls</extension>
+ <mime-type>text/vnd.wap.wmlscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Compiled WML Script -->
+ <extension>wmlsc</extension>
+ <mime-type>application/vnd.wap.wmlscriptc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wmv</extension>
+ <mime-type>video/x-ms-wmv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wmx</extension>
+ <mime-type>video/x-ms-wmx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wmz</extension>
+ <mime-type>application/x-msmetafile</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>woff</extension>
+ <mime-type>application/x-font-woff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wpd</extension>
+ <mime-type>application/vnd.wordperfect</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wpl</extension>
+ <mime-type>application/vnd.ms-wpl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wps</extension>
+ <mime-type>application/vnd.ms-works</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wqd</extension>
+ <mime-type>application/vnd.wqd</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wri</extension>
+ <mime-type>application/x-mswrite</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wrl</extension>
+ <mime-type>model/vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wsdl</extension>
+ <mime-type>application/wsdl+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wspolicy</extension>
+ <mime-type>application/wspolicy+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wtb</extension>
+ <mime-type>application/vnd.webturbo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wvx</extension>
+ <mime-type>video/x-ms-wvx</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>x32</extension>
+ <mime-type>application/x-authorware-bin</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>x3d</extension>
+ <mime-type>model/x3d+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>x3db</extension>
+ <mime-type>model/x3d+binary</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>x3dbz</extension>
+ <mime-type>model/x3d+binary</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>x3dv</extension>
+ <mime-type>model/x3d+vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>x3dvz</extension>
+ <mime-type>model/x3d+vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>x3dz</extension>
+ <mime-type>model/x3d+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xaml</extension>
+ <mime-type>application/xaml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xap</extension>
+ <mime-type>application/x-silverlight-app</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xar</extension>
+ <mime-type>application/vnd.xara</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xbap</extension>
+ <mime-type>application/x-ms-xbap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xbd</extension>
+ <mime-type>application/vnd.fujixerox.docuworks.binder</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xbm</extension>
+ <mime-type>image/x-xbitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xdf</extension>
+ <mime-type>application/xcap-diff+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xdm</extension>
+ <mime-type>application/vnd.syncml.dm+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xdp</extension>
+ <mime-type>application/vnd.adobe.xdp+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xdssc</extension>
+ <mime-type>application/dssc+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xdw</extension>
+ <mime-type>application/vnd.fujixerox.docuworks</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xenc</extension>
+ <mime-type>application/xenc+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xer</extension>
+ <mime-type>application/patch-ops-error+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xfdf</extension>
+ <mime-type>application/vnd.adobe.xfdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xfdl</extension>
+ <mime-type>application/vnd.xfdl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xht</extension>
+ <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xhtml</extension>
+ <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xhvml</extension>
+ <mime-type>application/xv+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xif</extension>
+ <mime-type>image/vnd.xiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xla</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlam</extension>
+ <mime-type>application/vnd.ms-excel.addin.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlc</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlf</extension>
+ <mime-type>application/x-xliff+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlm</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xls</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlsb</extension>
+ <mime-type>application/vnd.ms-excel.sheet.binary.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlsm</extension>
+ <mime-type>application/vnd.ms-excel.sheet.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlsx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlt</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xltm</extension>
+ <mime-type>application/vnd.ms-excel.template.macroenabled.12</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xltx</extension>
+ <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.template</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xlw</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xm</extension>
+ <mime-type>audio/xm</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xml</extension>
+ <mime-type>application/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xo</extension>
+ <mime-type>application/vnd.olpc-sugar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xop</extension>
+ <mime-type>application/xop+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpi</extension>
+ <mime-type>application/x-xpinstall</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpl</extension>
+ <mime-type>application/xproc+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpm</extension>
+ <mime-type>image/x-xpixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpr</extension>
+ <mime-type>application/vnd.is-xpr</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xps</extension>
+ <mime-type>application/vnd.ms-xpsdocument</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpw</extension>
+ <mime-type>application/vnd.intercon.formnet</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpx</extension>
+ <mime-type>application/vnd.intercon.formnet</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xsl</extension>
+ <mime-type>application/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xslt</extension>
+ <mime-type>application/xslt+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xsm</extension>
+ <mime-type>application/vnd.syncml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xspf</extension>
+ <mime-type>application/xspf+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xul</extension>
+ <mime-type>application/vnd.mozilla.xul+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xvm</extension>
+ <mime-type>application/xv+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xvml</extension>
+ <mime-type>application/xv+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xwd</extension>
+ <mime-type>image/x-xwindowdump</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xyz</extension>
+ <mime-type>chemical/x-xyz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xz</extension>
+ <mime-type>application/x-xz</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>yang</extension>
+ <mime-type>application/yang</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>yin</extension>
+ <mime-type>application/yin+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z</extension>
+ <mime-type>application/x-compress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>Z</extension>
+ <mime-type>application/x-compress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z1</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z2</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z3</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z4</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z5</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z6</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z7</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z8</extension>
+ <mime-type>application/x-zmachine</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zaz</extension>
+ <mime-type>application/vnd.zzazz.deck+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zip</extension>
+ <mime-type>application/zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zir</extension>
+ <mime-type>application/vnd.zul</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zirz</extension>
+ <mime-type>application/vnd.zul</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zmm</extension>
+ <mime-type>application/vnd.handheld-entertainment+xml</mime-type>
+ </mime-mapping>
+
+ <!-- ==================== Default Welcome File List ===================== -->
+ <!-- When a request URI refers to a directory, the default servlet looks -->
+ <!-- for a "welcome file" within that directory and, if present, to the -->
+ <!-- corresponding resource URI for display. -->
+ <!-- If no welcome files are present, the default servlet either serves a -->
+ <!-- directory listing (see default servlet configuration on how to -->
+ <!-- customize) or returns a 404 status, depending on the value of the -->
+ <!-- listings setting. -->
+ <!-- -->
+ <!-- If you define welcome files in your own application's web.xml -->
+ <!-- deployment descriptor, that list *replaces* the list configured -->
+ <!-- here, so be sure to include any of the default values that you wish -->
+ <!-- to use within your application. -->
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/db/mysql/db-schema.sql b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/db/mysql/db-schema.sql
new file mode 100644
index 0000000..d3bd93e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/db/mysql/db-schema.sql
@@ -0,0 +1,50 @@
+#*******************************************************************************
+# 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.
+#*******************************************************************************
+/******************drop old database and user***************************/
+use mysql;
+drop database IF EXISTS jujuvnfmdb;
+delete from user where User='jujuvnfm';
+FLUSH PRIVILEGES;
+
+/******************create new database and user***************************/
+create database jujuvnfmdb CHARACTER SET utf8;
+
+GRANT ALL PRIVILEGES ON jujuvnfmdb.* TO 'jujuvnfm'@'%' IDENTIFIED BY 'jujuvnfm' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON mysql.* TO 'jujuvnfm'@'%' IDENTIFIED BY 'jujuvnfm' WITH GRANT OPTION;
+
+GRANT ALL PRIVILEGES ON jujuvnfmdb.* TO 'jujuvnfm'@'localhost' IDENTIFIED BY 'jujuvnfm' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON mysql.* TO 'jujuvnfm'@'localhost' IDENTIFIED BY 'jujuvnfm' WITH GRANT OPTION;
+FLUSH PRIVILEGES;
+
+use jujuvnfmdb;
+set Names 'utf8';
+
+/******************drop old table and create new***************************/
+
+DROP TABLE IF EXISTS jujuvnfm;
+CREATE TABLE jujuvnfm (
+ ID VARCHAR(128) NOT NULL,
+ VNFM_ID VARCHAR(256) NULL,
+ VNF_ID VARCHAR(256) NULL,
+ APP_NAME VARCHAR(256) NULL,
+ JOB_ID VARCHAR(256) NULL,
+ STATUS INT NULL,
+ CREATE_TIME DATETIME NULL,
+ MODIFY_TIME DATETIME NULL,
+ DELETE_TIME DATETIME NULL,
+ EXTEND TEXT NULL,
+ CONSTRAINT jujuvnfm PRIMARY KEY(ID)
+); \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo.json
new file mode 100644
index 0000000..962c28d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo.json
@@ -0,0 +1,14 @@
+{
+ "serviceName": "jujuvnfm",
+ "version": "v1",
+ "url": "/openoapi/jujuvnfm/v1",
+ "protocol": "REST",
+ "visualRange": "1",
+ "nodes": [
+ {
+ "ip": "127.0.0.1",
+ "port": "8483",
+ "ttl": 0
+ }
+ ]
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo2drivermgr.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo2drivermgr.json
new file mode 100644
index 0000000..81d6b3c
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/adapterInfo/jujuadapterinfo2drivermgr.json
@@ -0,0 +1,28 @@
+{
+ "driverInfo": {
+ "driverName": "jujuvnfm",
+ "instanceID": "jujuvnfm",
+ "ip": "127.0.0.1",
+ "port": "8483",
+ "protocol": "http",
+ "services": [{
+ "service_url": "/openoapi/jujuvnfm/v1",
+ "support_sys": [{
+ "type": "vnfm",
+ "version": "V1"
+ }, {
+ "type": "vnfm",
+ "version": "V1"
+ }
+ ]
+ }, {
+ "service_url": "/openoapi/jujuvnfm/v1",
+ "support_sys": [{
+ "type": "vnfm",
+ "version": "V1"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/juju_conf.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/juju_conf.json
new file mode 100644
index 0000000..ea40d5e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/juju_conf.json
@@ -0,0 +1,6 @@
+{
+ "image-metadata-url": "http://192.168.20.106/images",
+ "network": "demo-net",
+ "use-floating-ip": "True",
+ "use-default-secgroup": "True"
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/restclient.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/restclient.json
new file mode 100644
index 0000000..eec587e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/conf/restclient.json
@@ -0,0 +1,11 @@
+{
+ "defaultServer":
+ {
+ "host":"127.0.0.1",
+ "port":"80"
+ },
+ "ConnectTimeout":"300000",
+ "thread":"10",
+ "idletimeout":"500000",
+ "timeout":"300000"
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/csarInfo/csarinfo.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/csarInfo/csarinfo.json
new file mode 100644
index 0000000..d061cb8
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/deployment/src/main/release/etc/csarInfo/csarinfo.json
@@ -0,0 +1,4 @@
+{
+ "csar_file_path": "/opt/csar/",
+ "csar_file_name": "VCPE_VNF.zip"
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/pom.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/pom.xml
new file mode 100644
index 0000000..3e78def
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>juju-vnfmadapter</artifactId>
+ <groupId>org.openo.nfvo</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>juju-vnfmadapter-service-root</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <name>nfvo/drivers/vnfm/gvnfm/juju/juju-vnfmadapter/Juju-vnfmadapterService</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <package.name>juju-vnfmadapter-service</package.name>
+ </properties>
+
+ <modules>
+ <module>service</module>
+ <module>deployment</module>
+ </modules>
+
+</project>
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/pom.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/pom.xml
new file mode 100644
index 0000000..265f5fb
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/pom.xml
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2016-2017 Huawei Technologies Co., Ltd and others.
+
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openo.nfvo</groupId>
+ <artifactId>juju-vnfmadapter-service-root</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>juju-vnfmadapter-service</artifactId>
+ <name>nfvo/drivers/vnfm/gvnfm/juju/juju-vnfmadapter/Juju-vnfmadapterService/service</name>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>3.1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mybatis</groupId>
+ <artifactId>mybatis-spring</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mybatis</groupId>
+ <artifactId>mybatis</artifactId>
+ <version>3.2.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-asm</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-expression</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>3.1.0.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-jaxrs</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>1.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>3.1.2.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-cache</artifactId>
+ <version>4.3.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpmime</artifactId>
+ <version>4.3.5</version>
+ </dependency>
+ <!-- <dependency>
+ <groupId>org.openo.integration</groupId>
+ <artifactId>org.openo.sdno.testframework</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency> -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>commonlib-cbb</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>commonlib-restclient</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.36</version>
+ </dependency>
+ <!--authorization.filter -->
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.19</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit-coverage</artifactId>
+ <version>1.19</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.15</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.tukaani</groupId>
+ <artifactId>xz</artifactId>
+ <version>1.3</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/all-tests/config.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/all-tests/config.properties
new file mode 100644
index 0000000..3854f96
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/all-tests/config.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# 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.
+###############################################################################
+profile=all-tests \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/dev/config.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/dev/config.properties
new file mode 100644
index 0000000..cdb8830
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/dev/config.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# 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.
+###############################################################################
+profile=dev \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/integration-test/config.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/integration-test/config.properties
new file mode 100644
index 0000000..9da0f1b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/profiles/integration-test/config.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# 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.
+###############################################################################
+profile=integration-test \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java
new file mode 100644
index 0000000..1495ad9
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.jujuvnfmadapter.service.rest;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.testmanager.TestManager;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 29, 2016
+ */
+public class ITConfigRoaTest extends TestManager {
+ private static final String GET_SUCCESS_PATH = "testcase/configroa/setDebugModelTestSuccess.json";
+ private static final String GET_FAIL_PATH = "testcase/configroa/setDebugModelTestFail.json";
+
+ @Test
+ public void setDebugModelTestSuccess() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_SUCCESS_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertNotNull(dataObj);
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+ @Test
+ public void setDebugModelTestFail() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_FAIL_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status != 200){
+ return true;
+ }
+ return false;
+ }
+
+ });
+ }
+
+ public static String getClassPath(){
+ String path = ClassLoader.getSystemClassLoader().getResource("./").getPath();
+ if(path.endsWith("/")){
+ path = path.substring(0, path.length()-1);
+ }
+ return path;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java
new file mode 100644
index 0000000..363e85e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.jujuvnfmadapter.service.rest;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.testmanager.TestManager;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 29, 2016
+ */
+public class ITJujuClientRoaTest extends TestManager {
+ private static final String GETVNFSTATUS_PATH = "testcase/jujuclientroa/getVnfStatus.json";
+ private static final String DEPLOYSERIVCE_PATH = "testcase/jujuclientroa/deploySerivce.json";
+// private static final String GETVNFSTATUS_PATH = "testcase/jujuclientroa/getVnfStatus.json";
+
+ @Test
+ public void getVnfStatus() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GETVNFSTATUS_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertEquals(dataObj.get(EntityUtils.RESULT_CODE_KEY),"0");
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+
+ @Test
+ public void deploySerivce() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+DEPLOYSERIVCE_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertNotNull(dataObj);
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+
+
+ public static String getClassPath(){
+ String path = ClassLoader.getSystemClassLoader().getResource("./").getPath();
+ if(path.endsWith("/")){
+ path = path.substring(0, path.length()-1);
+ }
+ return path;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java
new file mode 100644
index 0000000..bb5ff7d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.jujuvnfmadapter.service.rest;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.testmanager.TestManager;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 29, 2016
+ */
+public class ITVnfRoaTest extends TestManager {
+ private static final String GET_SUCCESS_PATH = "testcase/configroa/setDebugModelTestSuccess.json";
+ private static final String GET_FAIL_PATH = "testcase/configroa/setDebugModelTestFail.json";
+
+ @Test
+ public void addVnfTestSuccess() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_SUCCESS_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertNotNull(dataObj);
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+ @Test
+ public void addVnfTestFail() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_FAIL_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status != 200){
+ return true;
+ }
+ return false;
+ }
+
+ });
+ }
+
+ public static String getClassPath(){
+ String path = ClassLoader.getSystemClassLoader().getResource("./").getPath();
+ if(path.endsWith("/")){
+ path = path.substring(0, path.length()-1);
+ }
+ return path;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties
new file mode 100644
index 0000000..55d99f6
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties
@@ -0,0 +1,29 @@
+###############################################################################
+# 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.
+###############################################################################
+
+## 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/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json
new file mode 100644
index 0000000..258a256
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/config/debug/1r",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {
+ }
+ },
+ "response": {
+ "status": 500,
+ "json": {
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json
new file mode 100644
index 0000000..2ba2bc4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/config",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json
new file mode 100644
index 0000000..e9f9b4d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/deploy",
+ "method": "post",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {"appName":"testApp"}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json
new file mode 100644
index 0000000..5a978a2
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json
new file mode 100644
index 0000000..1b07b65
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/testabc/status",
+ "method": "post",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {
+ "appName":"testApp"
+ }
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/server.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/server.properties
new file mode 100644
index 0000000..55d99f6
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/server.properties
@@ -0,0 +1,29 @@
+###############################################################################
+# 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.
+###############################################################################
+
+## 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/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestFail.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestFail.json
new file mode 100644
index 0000000..258a256
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestFail.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/config/debug/1r",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {
+ }
+ },
+ "response": {
+ "status": 500,
+ "json": {
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestSuccess.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestSuccess.json
new file mode 100644
index 0000000..2ba2bc4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/configroa/setDebugModelTestSuccess.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/config",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/deploySerivce.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/deploySerivce.json
new file mode 100644
index 0000000..e9f9b4d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/deploySerivce.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/deploy",
+ "method": "post",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {"appName":"testApp"}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/destroySerivce.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/destroySerivce.json
new file mode 100644
index 0000000..5a978a2
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/destroySerivce.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/getVnfStatus.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/getVnfStatus.json
new file mode 100644
index 0000000..1b07b65
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/resources/testcase/jujuclientroa/getVnfStatus.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/testabc/status",
+ "method": "post",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {
+ "appName":"testApp"
+ }
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallback.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallback.java
new file mode 100644
index 0000000..2369d18
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallback.java
@@ -0,0 +1,46 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import org.openo.baseservice.roa.util.restclient.RestfulAsyncCallback;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * Async Callback class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class AsyncCallback implements RestfulAsyncCallback {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AsyncCallback.class);
+
+ @Override
+ public void callback(RestfulResponse response) {
+ LOGGER.warn("function=callback, msg=status={}, content={}.", response.getStatus(), response.getResponseContent());
+ }
+
+ @Override
+ public void handleExcepion(Throwable e) {
+ LOGGER.error("function=callback, msg= e is {}.", e);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/BaseTimeJob.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/BaseTimeJob.java
new file mode 100644
index 0000000..1698702
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/BaseTimeJob.java
@@ -0,0 +1,85 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.util.Calendar;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+/**
+ *
+ * Base time job class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public abstract class BaseTimeJob implements Runnable {
+
+ private ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
+
+ private long initialDelay = 1;
+
+ private long period = 1;
+
+ private String startTime = "";
+
+ @Override
+ public abstract void run();
+
+ /**
+ *
+ * Stop method.<br>
+ *
+ * @since NFVO 0.5
+ */
+ public void stop() {
+ service.shutdown();
+ }
+
+ public void setInitialDelay(long initialDelay) {
+ this.initialDelay = initialDelay;
+ }
+
+ public void setPeriod(long period) {
+ this.period = period;
+ }
+
+ /**
+ *
+ * Start method.<br>
+ *
+ * @since NFVO 0.5
+ */
+ public void start() {
+ if(startTime.length() != 0) {
+ String[] vnfTime = startTime.split(":");
+ if(vnfTime.length == 2) {
+ int minute = Integer.parseInt(vnfTime[0]) * 60 + Integer.parseInt(vnfTime[1]);
+ Calendar calendar = Calendar.getInstance();
+ int curMinute = calendar.get(Calendar.HOUR_OF_DAY) * 60 + calendar.get(Calendar.MINUTE);
+ if(curMinute <= minute) {
+ initialDelay = (minute - curMinute) * 60L;
+ } else {
+ initialDelay = (minute + 24 * 60 - curMinute) * 60L;
+ }
+ }
+ }
+ service.scheduleAtFixedRate(this, initialDelay, period, TimeUnit.SECONDS);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtil.java
new file mode 100644
index 0000000..9582f52
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtil.java
@@ -0,0 +1,63 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+/**
+ *
+ * Cryptographic utility class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public final class CryptUtil {
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ */
+ private CryptUtil() {
+ //Empty Constructor
+ }
+
+ /**
+ *
+ * Decription.<br>
+ *
+ * @param pwd
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String deCrypt(String pwd) {
+ return pwd;
+ }
+
+ /**
+ *
+ * Encryption.<br>
+ *
+ * @param pwd
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String enCrypt(String pwd) {
+ return pwd;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManager.java
new file mode 100644
index 0000000..dd21809
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManager.java
@@ -0,0 +1,240 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.http.Header;
+import org.apache.http.HeaderElement;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+/**
+ * Utility class to download CSAR
+ *
+ * @author
+ * @version NFVO 0.5 Sep 5, 2016
+ *
+ */
+public class DownloadCsarManager {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DownloadCsarManager.class);
+
+ public static final int CACHE = 100 * 1024;
+
+ private DownloadCsarManager(){
+ //private constructor
+ }
+
+ /**
+ * Download from given URL.
+ * @param url String
+ * @return
+ */
+ public static String download(String url) {
+ return download(url, null);
+ }
+
+ /**
+ * Download from given URL to given file location.
+ * @param url String
+ * @param filepath String
+ * @return
+ */
+ public static String download(String url, String filepath) {
+ String status = "";
+ try {
+ CloseableHttpClient client = HttpClients.createDefault();
+ HttpGet httpget = new HttpGet(url);
+ CloseableHttpResponse response = client.execute(httpget);
+
+ HttpEntity entity = response.getEntity();
+ InputStream is = entity.getContent();
+ if (filepath == null){
+ filepath = getFilePath(response); //NOSONAR
+ }
+
+ File file = new File(filepath);
+ file.getParentFile().mkdirs();
+ FileOutputStream fileout = new FileOutputStream(file);
+
+ byte[] buffer = new byte[CACHE];
+ int ch;
+ while ((ch = is.read(buffer)) != -1) {
+ fileout.write(buffer,0,ch);
+ }
+ is.close();
+ fileout.flush();
+ fileout.close();
+ status = Constant.DOWNLOADCSAR_SUCCESS;
+
+ } catch (Exception e) {
+ status = Constant.DOWNLOADCSAR_FAIL;
+ LOG.error("Download csar file failed! "+ e.getMessage(), e);
+ }
+ return status;
+ }
+
+ /**
+ * Retrieve file path from given response.
+ * @param response HttpResponse
+ * @return
+ */
+ public static String getFilePath(HttpResponse response) {
+ String filepath = System.getProperty("java.home");
+ String filename = getFileName(response);
+
+ if (filename != null) {
+ filepath += filename;
+ } else {
+ filepath += getRandomFileName();
+ }
+ return filepath;
+ }
+
+ /**
+ * Retrieve file name from given response.
+ * @param response HttpResponse
+ * @return
+ */
+ public static String getFileName(HttpResponse response) {
+ Header contentHeader = response.getFirstHeader("Content-Disposition");
+ String filename = null;
+ if (contentHeader != null) {
+ HeaderElement[] values = contentHeader.getElements();
+ if (values.length == 1) {
+ NameValuePair param = values[0].getParameterByName("filename");
+ if (param != null) {
+ try {
+ filename = param.getValue();
+ } catch (Exception e) {
+ LOG.error("getting filename failed! "+ e.getMessage(), e);
+ }
+ }
+ }
+ }
+ return filename;
+ }
+
+ /**
+ * Provides random file name.
+ * @return
+ */
+ public static String getRandomFileName() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ /**
+ * unzip CSAR packge
+ * @param fileName filePath
+ * @return
+ */
+ public static int unzipCSAR(String fileName,String filePath){
+ final int BUFFER = 2048;
+ int status=0;
+
+ try {
+ ZipFile zipFile = new ZipFile(fileName);
+ Enumeration emu = zipFile.entries();
+ int i=0;
+ while(emu.hasMoreElements()){
+ ZipEntry entry = (ZipEntry)emu.nextElement();
+ //read directory as file first,so only need to create directory
+ if (entry.isDirectory())
+ {
+ new File(filePath + entry.getName()).mkdirs();
+ continue;
+ }
+ BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry));
+ File file = new File(filePath + entry.getName());
+ //Because that is random to read zipfile,maybe the file is read first
+ //before the directory is read,so we need to create directory first.
+ File parent = file.getParentFile();
+ if(parent != null && (!parent.exists())){
+ parent.mkdirs();
+ }
+ FileOutputStream fos = new FileOutputStream(file);
+ BufferedOutputStream bos = new BufferedOutputStream(fos,BUFFER);
+
+ int count;
+ byte data[] = new byte[BUFFER];
+ while ((count = bis.read(data, 0, BUFFER)) != -1)
+ {
+ bos.write(data, 0, count);
+ }
+ bos.flush();
+ bos.close();
+ bis.close();
+
+ if(entry.getName().endsWith(".zip")){
+ File subFile = new File(filePath+entry.getName());
+ if(subFile.exists()){
+ int subStatus = unzipCSAR(filePath+entry.getName(),subFile.getParent()+"/");
+ if(subStatus != 0){
+ LOG.error("sub file unzip fail!"+subFile.getName());
+ status=Constant.UNZIP_FAIL;
+ return status;
+ }
+ }
+ }
+ }
+ status=Constant.UNZIP_SUCCESS;
+ zipFile.close();
+ } catch (Exception e) {
+ status=Constant.UNZIP_FAIL;
+ e.printStackTrace();
+ }
+ return status;
+ }
+
+ private static String getImagesPath(String csarfilepath){
+ File imageFile = new File(csarfilepath+"SoftwareImages");
+ if(imageFile.exists()){
+ File[] charmFiles = imageFile.listFiles();
+ for(File file : charmFiles){
+ if(!file.getName().endsWith(".zip")){
+ return file.getAbsolutePath();
+ }
+ }
+ }
+ return csarfilepath;
+ }
+ public static void main(String[] args) {
+ System.out.println(getImagesPath("e:/juju/csar2/"));
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtils.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtils.java
new file mode 100644
index 0000000..9899c34
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtils.java
@@ -0,0 +1,297 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.File;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 30, 2016
+ */
+public class EntityUtils {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EntityUtils.class);
+
+ public static final String RESULT_CODE_KEY = "retCode";
+
+ public static final String MSG_KEY = "msg";
+
+ public static final String DATA_KEY = "data";
+
+ public static final String STATUS = "status";
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ */
+ private EntityUtils() {
+ // Empty Constructor
+ }
+
+ /**
+ * <br>
+ *
+ * @param jsonObject
+ * @param clazz
+ * @return T
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T toEntity(JSONObject jsonObject, Class<?> clazz) throws Exception { // NOSONAR
+ T instance = (T)clazz.newInstance();
+ Field[] fields = clazz.getDeclaredFields();
+ for(int i = 0; i < fields.length; i++) {
+ fields[i].setAccessible(true);
+ fields[i].set(instance, jsonObject.get(fields[i].getName()));
+ }
+ return instance;
+ }
+
+ /**
+ * format the obj to str style as json format.
+ * <br/>
+ *
+ * @param obj
+ * @param clazz
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String toString(Object obj, Class<?> clazz) {
+ JSONObject jsonObj = new JSONObject();
+ try {
+ Field[] fields = clazz.getDeclaredFields();
+ for(int i = 0; i < fields.length; i++) {
+ fields[i].setAccessible(true);
+ jsonObj.put(fields[i].getName(), obj != null ? fields[i].get(obj) : "");
+ }
+ } catch(Exception e) {
+ LOG.error("to string error:", e);
+ }
+ return jsonObj.toString();
+ }
+
+ /**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ */
+ public static class ExeRes {
+
+ public static final int SUCCESS = 0;
+
+ public static final int FAILURE = -1;
+
+ private int code;
+
+ private String body;
+
+ /**
+ * @return Returns the code.
+ */
+ public int getCode() {
+ return code;
+ }
+
+ /**
+ * @param code The code to set.
+ */
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ /**
+ * @return Returns the body.
+ */
+ public String getBody() {
+ return body;
+ }
+
+ /**
+ * @param body The body to set.
+ */
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ return EntityUtils.toString(this, this.getClass());
+ } catch(Exception e) {
+ LOG.error("to string error:", e);
+ return "code:" + this.getCode() + ",body:" + this.getBody();
+ }
+ }
+
+ }
+
+ /**
+ * <br>
+ *
+ * @param command
+ * @return String
+ */
+ public static String formatCommand(List<String> command) {
+ StringBuilder builder = new StringBuilder();
+ if(command != null) {
+ for(String cmd : command) {
+ builder.append(cmd).append(" "); // NOSONAR
+ }
+ }
+ return builder.toString();
+
+ }
+
+ /**
+ * <br>
+ *
+ * @param dir
+ * @param command
+ * @return
+ */
+ public static ExeRes execute(String dir, String... command) {
+ List<String> commands = new ArrayList<>(command.length);
+ for(String arg : command) {
+ commands.add(arg);
+ }
+ return execute(dir, commands);
+
+ }
+
+ /**
+ * execute local command
+ * <br/>
+ *
+ * @param dir the command path
+ * @param command
+ * @return response msg
+ * @since NFVO 0.5
+ */
+ public static ExeRes execute(String dir, List<String> command) {
+ ExeRes er = new ExeRes();
+ StringBuilder sb = new StringBuilder();
+ try {
+ if(SwitchController.isDebugModel()) {
+ String resContent = new String(FileUtils.readFile(new File(JujuConfigUtil.getValue("juju_cmd_res_file")), "UTF-8"));
+ er.setBody(resContent);
+ return er;
+ }
+ ProcessBuilder pb = new ProcessBuilder(command);
+ if(StringUtils.isNotBlank(dir)) {
+ pb.directory(new File(dir));
+ }
+ pb.redirectErrorStream(true);
+ Process p = pb.start();
+
+ // wait the process result
+ buildProcessResult(er, p);
+
+ InputStream in = p.getInputStream();
+ byte[] buffer = new byte[1024];
+ int length;
+ while((length = in.read(buffer)) > 0) {
+ sb.append(new String(buffer, 0, length));
+ }
+ in.close();
+ er.setBody(sb.toString());
+ } catch(Exception e) {
+ er.setCode(ExeRes.FAILURE);
+ er.setBody(e.getMessage());
+ LOG.error("execute the command failed:{}", command, e);
+ }
+ return er;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param er
+ * @param p
+ * @throws TimeoutException
+ * @throws InterruptedException
+ * @since NFVO 0.5
+ */
+ private static void buildProcessResult(ExeRes er, Process p) throws TimeoutException, InterruptedException {
+ Worker worker = new Worker(p);
+ worker.start();
+ try {
+ worker.join(Constant.PROCESS_WAIT_MILLIS);
+ if(worker.exitValue != null) {
+ int exit = worker.exitValue;
+ if(exit != 0) {
+ er.setCode(ExeRes.FAILURE);
+ LOG.warn("the process exit non-normal");
+ } else {
+ er.setCode(ExeRes.SUCCESS);
+ }
+ } else {
+ er.setCode(ExeRes.FAILURE);
+ LOG.warn("the process execute timeout.");
+ throw new TimeoutException();
+ }
+ } catch(InterruptedException e) {
+ worker.interrupt();
+ Thread.currentThread().interrupt();
+ throw e;
+ }
+ }
+
+ private static class Worker extends Thread {
+
+ private final Process process;
+
+ private Integer exitValue;
+
+ private Worker(Process process) {
+ this.process = process;
+ }
+
+ /**
+ * <br/>
+ *
+ * @since NFVO 0.5
+ */
+ @Override
+ public void run() {
+ try {
+ exitValue = process.waitFor();
+ } catch(InterruptedException e) {
+ return;
+ }
+ }
+
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtils.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtils.java
new file mode 100644
index 0000000..cb68a5b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtils.java
@@ -0,0 +1,501 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * FileUtils
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 23, 2016
+ */
+public class FileUtils {
+
+ public static final String UTF8 = "UTF-8";
+
+ public static final String GBK = "GBK";
+
+ private static Logger log = LoggerFactory.getLogger(FileUtils.class);
+
+ private FileUtils(){
+
+ }
+ /**
+ * get current classPath as str. and the trailing slash will be remove
+ * <br/>
+ *
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getClassPath(){
+ String path = ClassLoader.getSystemClassLoader().getResource("./").getPath();
+ if(path.endsWith("/")){
+ path = path.substring(0, path.length()-1);
+ }
+ return path;
+ }
+ /**
+ * read data from the file
+ * <br/>
+ *
+ * @param file
+ * @param charsetName
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public static byte[] readFile(File file, String charsetName) throws IOException {
+ if(file != null) {
+ FileReader reader = new FileReader(file);
+ StringBuilder buffer = new StringBuilder();
+ char[] cbuf = new char[1024];
+ int legth;
+ while((legth = reader.read(cbuf)) != -1) {
+ buffer.append(new String(cbuf, 0, legth));
+ }
+ reader.close();
+ return buffer.toString().getBytes(charsetName);
+ }
+ return new byte[]{};
+ }
+
+ /**
+ * write data as file to the filePath
+ * <br/>
+ *
+ * @param data
+ * @param filePath
+ * @return
+ * @since NFVO 0.5
+ */
+ public static int writeFile(byte[] data, String filePath) {
+ try {
+ OutputStream out = new FileOutputStream(filePath);
+ out.write(data, 0, data.length);
+ out.close();
+ return 0;
+ } catch (Exception e) {
+ log.error("write file fail,filePath:"+filePath, e);
+ }
+ return -1;
+ }
+
+ /**
+ * List all files in directory
+ * @param file
+ * @return
+ * @throws FileNotFoundException
+ */
+ public static List<File> listFiles(File file) throws FileNotFoundException{
+ List<File> list = new ArrayList<>();
+ list(file, list);
+ return list;
+ }
+ /**
+ * List all files in directory
+ * @param file
+ * @param list
+ * @throws FileNotFoundException
+ */
+ private static void list(File file, List<File> list) throws FileNotFoundException{
+ if(!file.exists()){
+ throw new FileNotFoundException(file.getAbsolutePath());
+ }
+ File[] files = file.listFiles();
+ if(files != null && files.length > 0 ){
+ for(File f : files){
+ if(f.isFile()){
+ list.add(f);
+ }else{
+ list(f, list);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * createDirs (cycle create)
+ * <br/>
+ *
+ * @param file
+ * @since NFVO 0.5
+ */
+ public static void createDirs(File file){
+ if(file.getParentFile().exists()){
+ file.mkdir();
+ }else{
+ createDirs(file.getParentFile());
+ file.mkdir();
+ }
+ }
+
+ /**
+ *mkDirs
+ * <br/>
+ *
+ * @param path
+ * @since NFVO 0.5
+ */
+ public static void mkDirs(String path){
+ File file = new File(path);
+ createDirs(file);
+ }
+
+
+
+ public static String getSuperUrl(String file) {
+ return new File(file).getParentFile().getAbsolutePath();
+
+ }
+
+ /**
+ * absolute url
+ *
+ * @author sunny.sun
+ * @return file this application absolute url
+ */
+ public static String getAppAbsoluteUrl() {
+
+ // ��ȡ��class���ڵľ���·��
+ String file = UnCompressUtil.class.getClassLoader().getResource("/") == null ? null
+ : UnCompressUtil.class.getClassLoader().getResource("/").toString();
+ if (file == null) {
+ file = UnCompressUtil.class.getProtectionDomain().getCodeSource()
+ .getLocation().getFile().substring(1);
+ }
+ // ��class�ļ���war��ʱ������"zip:D:/ ..."����·��
+ if (file.startsWith("zip")) {
+ file = file.substring(4);
+
+ // ��class�ļ���class�ļ���ʱ������"file:/F:/ ..."����·��
+ } else if (file.startsWith("file")) {
+ file = file.substring(6);
+
+ // ��class�ļ���jar�ļ���ʱ������"jar:file:/F:/ ..."����·��
+ } else if (file.startsWith("jar")) {
+ file = file.substring(10);
+ }
+
+ if (!isWindows())
+ return ("/" + file).replace("%20", " ");
+
+ return file.replace("%20", " ");
+ }
+
+ public static String getWEBClassAbsoluteUrl() {
+
+ return getAppAbsoluteUrl();
+ }
+
+ /**
+ * @param floder
+ * @return
+ */
+ public static File newFloder(String floder) {
+ File file = new File(floder);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return file;
+ }
+
+
+
+ public static void copyFile(String oldPath, String newPath, boolean flag)
+ throws Exception {
+ int byteread = 0;
+ File oldfile = new File(oldPath);
+ if (oldfile.exists()) { // �ļ�����ʱ
+ if (flag == false) {
+ delFiles(newPath);
+ }
+ if (new File(newPath).exists() && flag == true) {
+ return;
+ }
+ newFile(newPath);
+ FileInputStream fis = new FileInputStream(oldPath); // ����ԭ�ļ�
+ FileOutputStream fos = new FileOutputStream(newPath);
+ byte[] buffer = new byte[1024];
+ while ((byteread = fis.read(buffer)) != -1) {
+ fos.write(buffer, 0, byteread);
+ }
+ fos.close();
+ fis.close();
+ } else {
+ throw new FileNotFoundException("the " + oldfile + " is not exits ");
+ }
+
+ }
+
+ /**
+ * @param filePathAndName
+ * String exp c:/fqf.txt
+ * @param fileContent
+ * String
+ * @return boolean
+ */
+ public static boolean delFiles(String filePathAndName) {
+
+ boolean flag = false;
+ File myDelFile = new File(filePathAndName);
+ if (!myDelFile.exists())
+ return true;
+ if (myDelFile.isDirectory()) {
+ File[] fs = myDelFile.listFiles();
+ for (int i = 0; i < fs.length; i++) {
+ if (fs[i].isFile())
+ flag = fs[i].delete();
+ if (fs[i].isDirectory()) {
+ flag = delFiles(fs[i].getAbsolutePath());
+ flag = fs[i].delete();
+ }
+ }
+ }
+ flag = myDelFile.delete();
+ return flag;
+ }
+
+ /**
+ * create new file
+ *
+ * @param filePathAndName
+ * String
+ * @return
+ * @throws IOException
+ */
+ public static File newFile(String fileName) throws IOException {
+ File file = new File(fileName);
+
+ newFloder(file.getParentFile().toString());
+
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ return file;
+ }
+
+ /**
+ * the file down all the hidden files
+ *
+ * @author sunny.sun
+ * */
+ public static List<File> getFiles(String path) {
+
+ List<File> list = new ArrayList<File>();
+ File file = new File(path);
+ if (!file.exists()) {
+
+ file.mkdirs();
+ }
+
+ File[] files = file.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isFile() && !files[i].isHidden()) {
+ list.add(files[i]);
+ }
+ if (files[i].isDirectory() && !files[i].isHidden()) {
+ List<File> list2 = getFiles(files[i].getPath());// use myself
+ list.addAll(list2);
+ }
+ }
+ return list;
+ }
+
+ /**
+ * causes the os of this computer is Windows
+ *
+ * @author sunny.sun
+ * */
+ public static boolean isWindows() {
+
+ String os = System.getProperty("os.name").toLowerCase();
+ // windows
+ return (os.indexOf("win") >= 0);
+
+ }
+
+ public static void copy(String oldfile, String newfile, boolean flag)
+ throws Exception {
+ File oldf = new File(oldfile);
+ File newf = new File(newfile);
+ boolean oisd = (oldfile.endsWith("/") || oldfile.endsWith("\\"));
+ boolean nisd = (newfile.endsWith("/") || newfile.endsWith("\\"));
+
+ // Դ�ļ�������
+ if (!oldf.exists()) {
+ throw new Exception("the from data is not exists ");
+ }
+ // ����ļ����У�������
+ if (oldf.exists() && !newf.exists()) {
+ if (newfile.endsWith("/") || newfile.endsWith("\\")) {
+ newFloder(newfile);
+ } else {
+ newFile(newfile);
+ }
+ }
+ // Ŀ�����ļ�����Դ���ļ���
+ if (oldf.exists() && oisd && !nisd) {
+ throw new Exception(
+ "the from data is directory,but the to data is a file");
+ }
+ // Դ�Ǹ��ļ�,Ŀ�����ļ�
+ if (!oisd && !nisd) {
+ copyFile(oldf.getAbsolutePath(), newf.getAbsolutePath(), flag);
+ }
+ // Դ�Ǹ��ļ��У�Ŀ�����ļ���
+ if (oisd && nisd) {
+ newFloder(newf.getAbsolutePath());
+ List<File> list = getFiles(oldf.getAbsolutePath());
+ for (int i = 0; i < list.size(); i++) {
+ copyFile(list.get(i).getAbsolutePath(), newf.getAbsolutePath()
+ + "/" + list.get(i).getName(), flag);
+ }
+ }
+ // Դ�Ǹ��ļ���Ŀ���Ǹ��ļ���
+ if (!oisd && nisd) {
+ newFloder(newf.getAbsolutePath());
+ copyFile(oldf.getAbsolutePath(), newf.getAbsolutePath() + "/"
+ + oldf.getName(), flag);
+ }
+
+ }
+
+ /**
+ * causes the os of this computer is mac
+ *
+ * @author sunny.sun
+ * */
+ public static boolean isMac() {
+
+ String os = System.getProperty("os.name").toLowerCase();
+ // Mac
+ return (os.indexOf("mac") >= 0);
+
+ }
+
+ /**
+ * causes the os of this computer is unix
+ *
+ * @author sunny.sun
+ * */
+ public static boolean isUnix() {
+
+ String os = System.getProperty("os.name").toLowerCase();
+ // linux or unix
+ return (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0);
+
+ }
+
+ /**
+ * @param file
+ * @return
+ * @throws Exception
+ */
+ public static boolean isUsed(String file) throws Exception {
+ File f = new File(file);
+ if (!f.exists()) {
+ throw new Exception("the file is not exists ..");
+ }
+ File f1 = new File(file + ".temp");
+ f.renameTo(f1);
+ if (f.exists()) {
+ return true;
+ } else {
+ f1.renameTo(f);
+ return false;
+ }
+
+ }
+ /**
+ * Remove the file name's extension (only remove the last)
+ * <br/>
+ *
+ * @param file
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getBaseFileName(File file){
+ if(file.getName().lastIndexOf(".") > 0){
+ return file.getName().substring(0,file.getName().lastIndexOf("."));
+ }else{
+ return file.getName();
+ }
+
+ }
+
+ /**
+ * fix file path to linux seperate,and remove the head and end slash
+ * <br/>
+ *
+ * @param path
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String fixPath(String path){
+ String newPath = path;
+ if(path == null){
+ return newPath;
+ }
+ newPath = newPath.replaceAll("\\\\", "/");
+ if(newPath.startsWith("/")){
+ newPath = newPath.substring(1, newPath.length());
+ }
+ if(newPath.endsWith("/")){
+ newPath = newPath.substring(0, newPath.length()-1);
+ }
+ return newPath;
+ }
+
+ /**
+ * fix file path to linux seperate,and add the head and end slash
+ * <br/>
+ *
+ * @param path
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getFriendlyPath(String path){
+ String newPath = path;
+ if(path == null){
+ return newPath;
+ }
+ newPath = newPath.replaceAll("\\\\", "/");
+ if(!newPath.startsWith("/")){
+ newPath = "/"+newPath;
+ }
+ if(!newPath.endsWith("/")){
+ newPath = newPath + "/";
+ }
+ return newPath;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtil.java
new file mode 100644
index 0000000..26ef602
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtil.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.jujuvnfmadapter.common;
+
+import java.util.ResourceBundle;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class JujuConfigUtil {
+
+ private static ResourceBundle bundle = ResourceBundle.getBundle("juju-config");
+
+ private JujuConfigUtil() {
+ // private constructor
+ }
+
+ /**
+ * read the juju-config.properties file
+ * <br/>
+ *
+ * @param key
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getValue(String key){
+ return bundle.getString(key);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtils.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtils.java
new file mode 100644
index 0000000..31886e4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtils.java
@@ -0,0 +1,263 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * For execute local command
+ * (support control overtime)
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 19, 2016
+ */
+public class LocalComandUtils {
+ private LocalComandUtils(){
+
+ }
+
+ private static final Logger log = LoggerFactory.getLogger(LocalComandUtils.class);
+
+
+ /**
+ * <br>
+ *
+ * @param command
+ * @return String
+ */
+ public static String formatCommand(List<String> command) {
+ StringBuilder builder = new StringBuilder();
+ if(command != null) {
+ for(String cmd : command) {
+ builder.append(cmd).append(" "); // NOSONAR
+ }
+ }
+ return builder.toString();
+
+ }
+
+ /**
+ * <br>
+ *
+ * @param dir
+ * @param command
+ * @return
+ */
+ public static ExeRes execute(String dir, String... command) {
+ List<String> commands = new ArrayList<>(command.length);
+ for(String arg : command) {
+ commands.add(arg);
+ }
+ return execute(dir, commands);
+
+ }
+
+ /**
+ * execute local command
+ * <br/>
+ *
+ * @param dir the command path
+ * @param command
+ * @param timeout millis
+ * @return response msg
+ * @since NFVO 0.5
+ */
+ public static ExeRes execute(String dir, List<String> command,long timeout) {
+ ExeRes er = new ExeRes();
+ StringBuilder sb = new StringBuilder();
+ try {
+ if(SwitchController.isDebugModel()) {
+ command.set(0, "juju.bat");
+ }
+ ProcessBuilder pb = new ProcessBuilder(command);
+ if(StringUtils.isNotBlank(dir)) {
+ pb.directory(new File(dir));
+ }
+ pb.redirectErrorStream(true);
+ Process p = pb.start();
+
+ // wait the process result
+ buildProcessResult(er, p, timeout);
+
+ InputStream in = p.getInputStream();
+ byte[] buffer = new byte[1024];
+ int length;
+ while((length = in.read(buffer)) > 0) {
+ sb.append(new String(buffer, 0, length));
+ }
+ in.close();
+ er.setBody(sb.toString());
+ } catch(Exception e) {
+ er.setCode(ExeRes.FAILURE);
+ er.setBody(e.getMessage());
+ log.error("execute the command failed:{}", command, e);
+ }
+ return er;
+ }
+
+ /**
+ * execute local command
+ * <br/>
+ *
+ * @param dir the command path
+ * @param command
+ * @return response msg
+ * @since NFVO 0.5
+ */
+ public static ExeRes execute(String dir, List<String> command) {
+ return execute(dir,command,Constant.PROCESS_WAIT_MILLIS);
+ }
+
+ /**
+ * <br/>
+ *
+ * @param er
+ * @param p
+ * @param timeout millis
+ * @throws TimeoutException
+ * @throws InterruptedException
+ * @since NFVO 0.5
+ */
+ private static void buildProcessResult(ExeRes er, Process p,long timeout) throws TimeoutException, InterruptedException {
+ Worker worker = new Worker(p);
+ worker.start();
+ try {
+ worker.join(timeout);
+ if(worker.exitValue != null) {
+ int exit = worker.exitValue;
+ if(exit != 0) {
+ er.setCode(ExeRes.FAILURE);
+ log.warn("the process exit non-normal");
+ } else {
+ er.setCode(ExeRes.SUCCESS);
+ }
+ } else {
+ er.setCode(ExeRes.FAILURE);
+ log.warn("the process execute timeout.");
+ throw new TimeoutException();
+ }
+ } catch(InterruptedException e) {
+ worker.interrupt();
+ Thread.currentThread().interrupt();
+ throw e;
+ }
+ }
+
+ /**
+ *
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 19, 2016
+ */
+ private static class Worker extends Thread {
+
+ private final Process process;
+
+ private Integer exitValue;
+
+ private Worker(Process process) {
+ this.process = process;
+ }
+
+ /**
+ * <br/>
+ *
+ * @since NFVO 0.5
+ */
+ @Override
+ public void run() {
+ try {
+ exitValue = process.waitFor();
+ } catch(InterruptedException e) {
+ return;
+ }
+ }
+
+ }
+
+ /**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ */
+ public static class ExeRes {
+
+ public static final int SUCCESS = 0;
+
+ public static final int FAILURE = -1;
+
+ private int code;
+
+ private String body;
+
+ /**
+ * @return Returns the code.
+ */
+ public int getCode() {
+ return code;
+ }
+
+ /**
+ * @param code The code to set.
+ */
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ /**
+ * @return Returns the body.
+ */
+ public String getBody() {
+ return body;
+ }
+
+ /**
+ * @param body The body to set.
+ */
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ return EntityUtils.toString(this, this.getClass());
+ } catch(Exception e) {
+ log.error("to string error:", e);
+ return "code:" + this.getCode() + ",body:" + this.getBody();
+ }
+ }
+
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtil.java
new file mode 100644
index 0000000..ccfa31a
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtil.java
@@ -0,0 +1,45 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+/**
+ *
+ * Resource utility class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class ResourceUtil {
+
+ private ResourceUtil() {
+
+ }
+
+ /**
+ *
+ * Get message.<br>
+ *
+ * @param key
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getMessage(String key) {
+ return key;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolder.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolder.java
new file mode 100644
index 0000000..118f3e4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolder.java
@@ -0,0 +1,107 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ *
+ * Spring context holder class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class SpringContextHolder implements ApplicationContextAware {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SpringContextHolder.class);
+
+ private static ApplicationContext appContext;
+
+ /**
+ * application context<br/>
+ *
+ * @param applicationContext
+ */
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ setAppContext(applicationContext);
+ }
+
+ /**
+ * <br>
+ *
+ * @return applicationContext
+ */
+ public static ApplicationContext getApplicationContext() {
+ checkApplicationContext();
+ return appContext;
+ }
+
+ /**
+ *
+ * Get spring bean.<br>
+ *
+ * @param name
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T getSpringBean(String name) {
+ checkApplicationContext();
+ return (T)appContext.getBean(name);
+ }
+
+ /**
+ *
+ * Get spring bean.<br>
+ *
+ * @param requiredType
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T getSpringBean(Class<T> requiredType) {
+ checkApplicationContext();
+ return (T)appContext.getBeansOfType(requiredType);
+ }
+
+ private static void checkApplicationContext() {
+ if(appContext == null) {
+ LOG.error("spring appContext do not insert.");
+ throw new IllegalStateException("spring appContext is null.");
+ }
+ }
+
+ /**
+ *
+ * Clean application context.<br>
+ *
+ * @since NFVO 0.5
+ */
+ public static void cleanApplicationContext() {
+ appContext = null;
+ }
+
+ private static void setAppContext(ApplicationContext applicationContext) {
+ SpringContextHolder.appContext = applicationContext;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtil.java
new file mode 100644
index 0000000..0e819d3
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtil.java
@@ -0,0 +1,148 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONException;
+import net.sf.json.JSONObject;
+import net.sf.json.util.JSONTokener;
+
+/**
+ *
+ * String utility class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public final class StringUtil {
+
+ private static final Logger LOG = LoggerFactory.getLogger(StringUtil.class);
+
+ private StringUtil() {
+
+ }
+
+ /**
+ *
+ * Check whther the string is valid or not.<br>
+ *
+ * @param str
+ * @return
+ * @since NFVO 0.5
+ */
+ public static boolean isValidString(String str) {
+ return str != null && !"".equals(str.trim());
+ }
+
+ /**
+ *
+ * Check whether the Url is valid or not.<br>
+ *
+ * @param url
+ * @return
+ * @since NFVO 0.5
+ */
+ public static boolean isValidUrl(String url) {
+ String reg =
+ "http[s]?://(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}:[0-9]{2,5}";
+ Pattern pattern = Pattern.compile(reg);
+ Matcher matcher = pattern.matcher(url);
+ return matcher.matches();
+ }
+
+ /**
+ *
+ * Get the JSON string from input http context.<br>
+ *
+ * @param vnfReq
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ try {
+ InputStream vnfInput = vnfReq.getInputStream();
+ String vnfJsonStr = IOUtils.toString(vnfInput);
+ JSONTokener vnfJsonTokener = new JSONTokener(vnfJsonStr);
+
+ if(vnfJsonTokener.nextClean() == Character.codePointAt("{", 0)) {
+ return (T)JSONObject.fromObject(vnfJsonStr);
+ }
+
+ vnfJsonTokener.back();
+
+ if(vnfJsonTokener.nextClean() == Character.codePointAt("[", 0)) {
+ return (T)JSONArray.fromObject(vnfJsonStr);
+ }
+ } catch(IOException e) {
+ LOG.error("function=getJsonFromContext, msg=IOException occurs, e={}.", e);
+ } catch(JSONException e) {
+ LOG.error("function=getJsonFromContext, msg=JSONException occurs, e={}.", e);
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * Translate sites to site array.<br>
+ *
+ * @param sites
+ * @return
+ * @since NFVO 0.5
+ */
+ public static JSONArray transSitesToArray(String sites) {
+ String[] siteList = sites.split("&");
+ int siteSize = siteList.length;
+ JSONArray siteArray = new JSONArray();
+ for(int i = 0; i < siteSize; i++) {
+ siteArray.add(siteList[i]);
+ }
+
+ return siteArray;
+ }
+
+ /**
+ *
+ * Check whether the string is valid or not.<br>
+ *
+ * @param fields
+ * @return
+ * @since NFVO 0.5
+ */
+ public static boolean isValidAnyString(String... fields) {
+ for(String str : fields) {
+ if(!isValidString(str)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SwitchController.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SwitchController.java
new file mode 100644
index 0000000..dbcdcf5
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/SwitchController.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.common;
+
+/**
+ * <br/>
+ * <p>
+ * to assist debug
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 13, 2016
+ */
+public class SwitchController {
+
+ /**
+ * turn debug model
+ */
+ private static boolean debugModel = false;
+ public static String vnfmServiceUrl = null;
+
+ public SwitchController() { //NOSONAR
+ //Constructor
+ }
+
+ /**
+ * @return Returns the debugModel.
+ */
+ public static boolean isDebugModel() {
+ return debugModel;
+ }
+
+
+ /**
+ * @param debugModel The debugModel to set.
+ */
+ public static void setDebugModel(boolean debugModel) {
+ SwitchController.debugModel = debugModel;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtil.java
new file mode 100644
index 0000000..eda6b78
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtil.java
@@ -0,0 +1,301 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.compress.archivers.ArchiveInputStream;
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.compressors.CompressorStreamFactory;
+import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Oct 28, 2016
+ */
+public class UnCompressUtil {
+
+ private static Logger log = LoggerFactory.getLogger(UnCompressUtil.class);
+
+ public static Map<String, String> archiveMap = new HashMap<String, String>();
+
+ public static Map<String, String> compressorMap = new HashMap<String, String>();
+
+ static {
+ // archive type
+ archiveMap.put(ArchiveStreamFactory.AR, ArchiveStreamFactory.AR);
+ archiveMap.put(ArchiveStreamFactory.ARJ, ArchiveStreamFactory.ARJ);
+ archiveMap.put(ArchiveStreamFactory.CPIO, ArchiveStreamFactory.CPIO);
+ archiveMap.put(ArchiveStreamFactory.DUMP, ArchiveStreamFactory.DUMP);
+ archiveMap.put(ArchiveStreamFactory.JAR, ArchiveStreamFactory.JAR);
+ archiveMap.put(ArchiveStreamFactory.SEVEN_Z, ArchiveStreamFactory.SEVEN_Z);
+ archiveMap.put(ArchiveStreamFactory.TAR, ArchiveStreamFactory.TAR);
+ archiveMap.put(ArchiveStreamFactory.ZIP, ArchiveStreamFactory.ZIP);
+
+ // compressor type
+ compressorMap.put(CompressorStreamFactory.BZIP2, CompressorStreamFactory.BZIP2);
+ compressorMap.put(CompressorStreamFactory.DEFLATE, CompressorStreamFactory.DEFLATE);
+ compressorMap.put(CompressorStreamFactory.GZIP, CompressorStreamFactory.GZIP);
+ compressorMap.put(CompressorStreamFactory.LZMA, CompressorStreamFactory.LZMA);
+ compressorMap.put(CompressorStreamFactory.PACK200, CompressorStreamFactory.PACK200);
+ compressorMap.put(CompressorStreamFactory.SNAPPY_FRAMED, CompressorStreamFactory.SNAPPY_FRAMED);
+ compressorMap.put(CompressorStreamFactory.SNAPPY_RAW, CompressorStreamFactory.SNAPPY_RAW);
+ compressorMap.put(CompressorStreamFactory.XZ, CompressorStreamFactory.XZ);
+ compressorMap.put(CompressorStreamFactory.Z, CompressorStreamFactory.Z);
+ }
+
+ /**
+ * tar.gz
+ * <br/>
+ *
+ * @param zipfileName
+ * @param outputDirectory
+ * @param fileNames
+ * @return
+ * @since NFVO 0.5
+ */
+ public static boolean unCompressGzip(String zipfileName, String outputDirectory, List<String> fileNames) {
+ FileInputStream fis = null;
+ ArchiveInputStream in = null;
+ BufferedInputStream bis = null;
+ try {
+ fis = new FileInputStream(zipfileName);
+ GZIPInputStream gis = new GZIPInputStream(new BufferedInputStream(fis));
+ in = new ArchiveStreamFactory().createArchiveInputStream("tar", gis);
+ bis = new BufferedInputStream(in);
+ TarArchiveEntry entry = (TarArchiveEntry)in.getNextEntry();
+ while(entry != null) {
+ String name = entry.getName();
+ String[] names = name.split("/");
+ String fileName = outputDirectory;
+ for(int i = 0; i < names.length; i++) {
+ String str = names[i];
+ fileName = fileName + File.separator + str;
+ }
+ if(name.endsWith("/")) {
+ FileUtils.mkDirs(fileName);
+ } else {
+ File file = getRealFileName(outputDirectory, name);
+ if(null != fileNames) {
+ fileNames.add(file.getName());
+ }
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
+ int b = -1;
+ while((b = bis.read()) != -1) {
+ bos.write(b);
+ }
+ log.debug("ungzip to:" + file.getCanonicalPath());
+ bos.flush();
+ bos.close();
+ }
+ entry = (TarArchiveEntry)in.getNextEntry();
+ }
+ return true;
+ } catch(Exception e) {
+ log.error("UnCompressGZip faield:", e);
+ return false;
+ } finally {
+ try {
+ if(null != bis) {
+ bis.close();
+ }
+ } catch(IOException e) {
+ log.error("UnCompressGZip faield:", e);
+ }
+ }
+ }
+
+ public static void unCompressAllZip(String sourcePath, String targetPath) throws FileNotFoundException {
+ for(File file : FileUtils.listFiles(new File(sourcePath))) {
+ unCompressZip(file.getAbsolutePath(),
+ targetPath + File.separator + file.getName().substring(0, file.getName().lastIndexOf(".")),new ArrayList<String>());
+ }
+ }
+
+ /**
+ * zip
+ * <br/>
+ *
+ * @param sourceFile unzipPath
+ * @param targetPath zippath
+ * @param fileNames
+ * @since NFVO 0.5
+ */
+ public static boolean unCompressZip(String sourceFile, String targetPath,List<String> fileNames) {
+ try {
+ BufferedOutputStream dest = null;
+ FileInputStream fis = new FileInputStream(sourceFile);
+ ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
+ ZipEntry entry = null;
+ while((entry = zis.getNextEntry()) != null) {
+ String name = entry.getName();
+ String[] names = name.split("/");
+ String fileName = targetPath;
+ for(int i = 0; i < names.length; i++) {
+ String str = names[i];
+ fileName = fileName + File.separator + str;
+ }
+ if(name.endsWith("/")) {
+ FileUtils.mkDirs(fileName);
+ } else {
+ int count;
+ byte data[] = new byte[2048];
+ File file = getRealFileName(targetPath, name);
+ fileNames.add(file.getName());
+ dest = new BufferedOutputStream(new FileOutputStream(file));
+
+ while((count = zis.read(data, 0, 2048)) != -1) {
+ dest.write(data, 0, count);
+ }
+ log.debug("unzip to:" + file.getCanonicalPath());
+ dest.flush();
+ dest.close();
+ }
+ }
+ zis.close();
+ return true;
+ } catch(Exception e) {
+ log.error("UnCompressZip faield:", e);
+ }
+ return false;
+ }
+
+ private static File getRealFileName(String zippath, String absFileName) {
+ String[] dirs = absFileName.split("/", absFileName.length());
+
+ File ret = new File(zippath);
+
+ if(dirs.length > 1) {
+ for(int i = 0; i < dirs.length - 1; i++) {
+ ret = new File(ret, dirs[i]);
+ }
+ }
+
+ if(!ret.exists()) {
+ ret.mkdirs();
+ }
+
+ ret = new File(ret, dirs[dirs.length - 1]);
+
+ return ret;
+ }
+
+ /**
+ * tar.xz
+ * <br/>
+ *
+ * @param zipfileName
+ * @param outputDirectory
+ * @param fileNames
+ * @return
+ * @since NFVO 0.5
+ */
+ public static boolean unCompressTarXZ(String zipfileName, String outputDirectory, List<String> fileNames) {
+ ArchiveInputStream in = null;
+ BufferedInputStream bis = null;
+ try {
+ XZCompressorInputStream xzis =
+ new XZCompressorInputStream(new BufferedInputStream(new FileInputStream(zipfileName)));
+ in = new ArchiveStreamFactory().createArchiveInputStream("tar", xzis);
+ bis = new BufferedInputStream(in);
+ TarArchiveEntry entry = (TarArchiveEntry)in.getNextEntry();
+ while(entry != null) {
+ String name = entry.getName();
+ String[] names = name.split("/");
+ String fileName = outputDirectory;
+ for(int i = 0; i < names.length; i++) {
+ String str = names[i];
+ fileName = fileName + File.separator + str;
+ }
+ if(name.endsWith("/")) {
+ FileUtils.mkDirs(fileName);
+ } else {
+ File file = getRealFileName(outputDirectory, name);
+ if(null != fileNames) {
+ fileNames.add(file.getName());
+ }
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
+ int b = -1;
+ while((b = bis.read()) != -1) {
+ bos.write(b);
+ }
+ log.debug("ungzip to:" + file.getCanonicalPath());
+ bos.flush();
+ bos.close();
+ }
+ entry = (TarArchiveEntry)in.getNextEntry();
+ }
+ return true;
+ } catch(Exception e) {
+ log.error("unCompressTarXZ faield:", e);
+ } finally {
+ try {
+ if(null != bis) {
+ bis.close();
+ }
+ } catch(IOException e) {
+ log.error("unCompressTarXZ faield:", e);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * only support .zip/.tar.gz/.tar.xz
+ * <br/>
+ *
+ * @param zipfileName
+ * @param outputDirectory
+ * @param fileNames
+ * @return
+ * @since NFVO 0.5
+ */
+ public static boolean unCompress(String zipfileName, String outputDirectory, List<String> fileNames) {
+ if(zipfileName.endsWith(".zip")){
+ return unCompressZip(zipfileName,outputDirectory,fileNames);
+ }else if(zipfileName.endsWith(".tar.gz")){
+ return unCompressGzip(zipfileName,outputDirectory,fileNames);
+ }else if(zipfileName.endsWith(".tar.xz")){
+ return unCompressTarXZ(zipfileName,outputDirectory,fileNames);
+ }else{
+ log.error("not supprot file type:->"+zipfileName);
+ return false;
+ }
+ }
+
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtil.java
new file mode 100644
index 0000000..57e7202
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtil.java
@@ -0,0 +1,420 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.io.IOUtils;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.ezmorph.object.DateMorpher;
+import net.sf.json.JSON;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONException;
+import net.sf.json.JSONObject;
+import net.sf.json.JsonConfig;
+import net.sf.json.processors.JsonValueProcessor;
+import net.sf.json.util.CycleDetectionStrategy;
+import net.sf.json.util.JSONTokener;
+import net.sf.json.util.JSONUtils;
+
+/**
+ *
+ * Virtual Network Function Json Utility class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 10, 2016
+ */
+public final class VNFJsonUtil {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VNFJsonUtil.class);
+
+ private static final ObjectMapper VNFMAPPER = new ObjectMapper();
+
+ private static final String ERROR = "error";
+ static {
+ VNFMAPPER.setDeserializationConfig(VNFMAPPER.getDeserializationConfig()
+ .without(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES));
+ }
+
+ private VNFJsonUtil() {
+ }
+
+ /**
+ *
+ * UnMarshal method.<br>
+ *
+ * @param vnfJsonstr
+ * @param type
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public static <T> T unMarshal(String vnfJsonstr, Class<T> type) throws IOException {
+ return VNFMAPPER.readValue(vnfJsonstr, type);
+ }
+
+ /**
+ *
+ * UnMarshal method.<br>
+ *
+ * @param vnfJsonstr
+ * @param type
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public static <T> T unMarshal(String vnfJsonstr, TypeReference<T> type) throws IOException {
+ return VNFMAPPER.readValue(vnfJsonstr, type);
+ }
+
+ /**
+ *
+ * Marshal method.<br>
+ *
+ * @param srcObj
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public static String marshal(Object srcObj) throws IOException {
+ if(srcObj instanceof JSON) {
+ return srcObj.toString();
+ }
+ return VNFMAPPER.writeValueAsString(srcObj);
+ }
+
+ public static ObjectMapper getMapper() {
+ return VNFMAPPER;
+ }
+
+ /**
+ *
+ * Get Json field string.<br>
+ *
+ * @param vnfJsonObj
+ * @param fieldName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getJsonFieldStr(JSONObject vnfJsonObj, String fieldName) {
+ if(null == vnfJsonObj || null == vnfJsonObj.get(fieldName) || "null".equals(vnfJsonObj.getString(fieldName))) {
+ LOG.warn("getJsonFieldStr: VNFJson object field(" + fieldName + ") is null.");
+ return "";
+ }
+
+ return vnfJsonObj.getString(fieldName);
+ }
+
+ /**
+ *
+ * Get Json field integer.<br>
+ *
+ * @param vnfJsonObj
+ * @param fieldName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static Integer getJsonFieldInt(JSONObject vnfJsonObj, String fieldName) {
+ if(null == vnfJsonObj || null == vnfJsonObj.get(fieldName)) {
+ LOG.warn("getJsonFieldInt: VNFJson object field(" + fieldName + ") is Null");
+ return 0;
+ }
+ return vnfJsonObj.getInt(fieldName);
+ }
+
+ /**
+ *
+ * Get Json field long.<br>
+ *
+ * @param vnfJsonObj
+ * @param fieldName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static Long getJsonFieldLong(JSONObject vnfJsonObj, String fieldName) {
+ if(null == vnfJsonObj || null == vnfJsonObj.get(fieldName)) {
+ LOG.warn("getJsonFieldLong: VNFJson object field(" + fieldName + ") is null");
+ return 0L;
+ }
+ return vnfJsonObj.getLong(fieldName);
+ }
+
+ /**
+ *
+ * Parse error information.<br>
+ *
+ * @param errorInfo
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String parseErrorInfo(String errorInfo) {
+ if((errorInfo != null) && (!errorInfo.isEmpty())) {
+ JSONObject errorInfoJst = JSONObject.fromObject(errorInfo);
+ if(errorInfoJst.has(ERROR) && errorInfoJst.getJSONObject(ERROR).has("message")) {
+ return errorInfoJst.getJSONObject(ERROR).getString("message");
+ }
+ }
+ return "System Error!";
+ }
+
+ static {
+ VNFMAPPER.setDeserializationConfig(VNFMAPPER.getDeserializationConfig()
+ .without(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES));
+ }
+
+ /**
+ *
+ * Convert VNF Json to objects.<br>
+ *
+ * @param vnfJsonString
+ * @param pojoCalss
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T vnfJsonToObjects(String vnfJsonString, Class<T> pojoCalss) {
+ JSONObject vnfJsonObject = JSONObject.fromObject(vnfJsonString);
+ return (T)JSONObject.toBean(vnfJsonObject, pojoCalss);
+ }
+
+ /**
+ *
+ * Convert VNF Json to objects.<br>
+ *
+ * @param vnfJsonString
+ * @param vnfJsonConfig
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T vnfJsonToObjects(String vnfJsonString, JsonConfig vnfJsonConfig) {
+ JSONObject vnfJsonObject = JSONObject.fromObject(vnfJsonString);
+ return (T)JSONObject.toBean(vnfJsonObject, vnfJsonConfig);
+ }
+
+ /**
+ *
+ * Convert VNF Json to lists.<br>
+ *
+ * @param vnfJsonString
+ * @param pojoClass
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> List<T> vnfJsonToLists(String vnfJsonString, Class<T> pojoClass) {
+ JSONArray vnfJsonVNFArray = JSONArray.fromObject(vnfJsonString);
+ JSONObject vnfJsonObject;
+ List<T> list = new ArrayList<>(20);
+ for(int i = 0; i < vnfJsonVNFArray.size(); i++) {
+ vnfJsonObject = vnfJsonVNFArray.getJSONObject(i);
+ list.add((T)JSONObject.toBean(vnfJsonObject, pojoClass));
+ }
+ return list;
+ }
+
+ /**
+ *
+ * Convert VNF Json to list.<br>
+ *
+ * @param vnfJsonString
+ * @param pojoClass
+ * @param dataFormat
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> List<T> vnfJsonToList(String vnfJsonString, Class<T> pojoClass, String dataFormat) {
+ JsonConfig vnfJsonConfig = configJson(dataFormat);
+ JSONArray vnfJsonVNFArray = JSONArray.fromObject(vnfJsonString, vnfJsonConfig);
+ JSONObject vnfJsonObject;
+ List<T> list = new ArrayList<>(20);
+ for(int i = 0; i < vnfJsonVNFArray.size(); i++) {
+ vnfJsonObject = vnfJsonVNFArray.getJSONObject(i);
+ list.add((T)JSONObject.toBean(vnfJsonObject, pojoClass));
+ }
+ return list;
+ }
+
+ /**
+ *
+ * Object to json string.<br>
+ *
+ * @param javaObj
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String objectToJsonStr(Object javaObj) {
+ JSONObject vnfJson = JSONObject.fromObject(javaObj);
+ return vnfJson.toString();
+ }
+
+ /**
+ *
+ * object to json.<br>
+ *
+ * @param javaObj
+ * @return
+ * @since NFVO 0.5
+ */
+ public static JSONObject objectToJson(Object javaObj) {
+ return JSONObject.fromObject(javaObj);
+ }
+
+ /**
+ *
+ * Object to json.<br>
+ *
+ * @param javaObj
+ * @param vnfJsonConfig
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String objectToJson(Object javaObj, JsonConfig vnfJsonConfig) {
+ JSONObject vnfJson = JSONObject.fromObject(javaObj, vnfJsonConfig);
+ return vnfJson.toString();
+ }
+
+ /**
+ *
+ * Object to json.<br>
+ *
+ * @param javaObj
+ * @param dataFormat
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String objectToJson(Object javaObj, String dataFormat) {
+ JsonConfig vnfJsonConfig = configJson(dataFormat);
+ JSONObject vnfJson = JSONObject.fromObject(javaObj, vnfJsonConfig);
+ return vnfJson.toString();
+
+ }
+
+ /**
+ *
+ * List to json.<br>
+ *
+ * @param list
+ * @return
+ * @since NFVO 0.5
+ */
+ public static <T> String listToJson(List<T> list) {
+ JSONArray vnfJson = JSONArray.fromObject(list);
+ return vnfJson.toString();
+ }
+
+ /**
+ *
+ * List to json.<br>
+ *
+ * @param list
+ * @param dataFormat
+ * @return
+ * @since NFVO 0.5
+ */
+ public static <T> String listToJson(List<T> list, String dataFormat) {
+ JsonConfig vnfJsonConfig = configJson(dataFormat);
+ JSONArray vnfJson = JSONArray.fromObject(list, vnfJsonConfig);
+ return vnfJson.toString();
+ }
+
+ /**
+ *
+ * Config json.<br>
+ *
+ * @param datePattern
+ * @return
+ * @since NFVO 0.5
+ */
+ public static JsonConfig configJson(final String datePattern) {
+
+ JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] {datePattern}));
+
+ JsonConfig vnfJsonConfig = new JsonConfig();
+ vnfJsonConfig.setIgnoreDefaultExcludes(false);
+ vnfJsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
+ vnfJsonConfig.registerJsonValueProcessor(Date.class, new JsonValueProcessor() {
+ @Override
+ public Object processObjectValue(String key, Object value, JsonConfig vnfJsonConfig) {
+ if(value instanceof Date) {
+ return new SimpleDateFormat(datePattern).format((Date)value);
+ }
+ return value == null ? null : value.toString();
+ }
+ @Override
+ public Object processArrayValue(Object value, JsonConfig vnfJsonConfig) {
+ String[] vnfObj = {};
+ SimpleDateFormat vnfSf = new SimpleDateFormat(datePattern);
+ if(value instanceof Date[]) {
+ Date[] dates = (Date[])value;
+ vnfObj = new String[dates.length];
+ for(int i = 0; i < dates.length; i++) {
+ vnfObj[i] = vnfSf.format(dates[i]);
+ }
+ }
+ return vnfObj;
+ }
+ });
+ return vnfJsonConfig;
+ }
+
+ /**
+ * @param context the HttpContext
+ * @param <T> JSONObject or JSONArray
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T getJsonFromContext(HttpServletRequest context) {
+ try {
+ InputStream input = context.getInputStream();
+ String vnfJsonStr = IOUtils.toString(input);
+ JSONTokener vnfVnfJsonTokener = new JSONTokener(vnfJsonStr);
+
+ // "{"
+ if(vnfVnfJsonTokener.nextClean() == Character.codePointAt("{", 0)) {
+ return (T)JSONObject.fromObject(vnfJsonStr);
+ }
+
+ vnfVnfJsonTokener.back();
+
+ // "["
+ if(vnfVnfJsonTokener.nextClean() == Character.codePointAt("[", 0)) {
+ return (T)JSONArray.fromObject(vnfJsonStr);
+ }
+ } catch(IOException e) {
+ LOG.error("function=getJsonFromContext,msg= IOException occurs. exception=" + e);
+ } catch(JSONException e) {
+ LOG.error("function=getJsonFromContext,msg= JSONException occurs, exception=" + e);
+ }
+ return null;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmException.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmException.java
new file mode 100644
index 0000000..3517442
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmException.java
@@ -0,0 +1,84 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+/**
+ *
+ * Vnfm exception class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class VnfmException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @since NFVO 0.5
+ */
+ public VnfmException() {
+ super();
+ }
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param message
+ * @param cause
+ * @since NFVO 0.5
+ */
+ public VnfmException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param message
+ * @since NFVO 0.5
+ */
+ public VnfmException(String message) {
+ super(message);
+ }
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param cause
+ * @since NFVO 0.5
+ */
+ public VnfmException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtil.java
new file mode 100644
index 0000000..9817156
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtil.java
@@ -0,0 +1,95 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.JujuVnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+/**
+ * Provide function of getting vnfmInfo
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 25, 2016
+ */
+public final class VnfmUtil {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfmUtil.class);
+ private VnfmUtil() {
+
+ }
+
+ /**
+ * Get vnfmInfo by ip
+ * <br/>
+ *
+ * @param vnfmId
+ * @return
+ * @since NFVO 0.5
+ */
+ public static JSONObject getVnfmById(String vnfmId) {
+ if(SwitchController.isDebugModel()){
+ JSONObject json = new JSONObject();
+ json.put("vnfmId", vnfmId);
+ json.put("vnfdId","testVnfdId");
+ json.put("vnfPackageId", "testPackageId");
+ json.put("version", "1");
+ json.put("url",JujuConfigUtil.getValue("jujuvnfm_server_url"));
+ return json;
+ }
+ RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(String.format(UrlConstant.REST_ESRINFO_GET, vnfmId), JujuVnfmRestfulUtil.GET_TYPE, null);
+ if(rsp == null || rsp.getStatus() != Constant.HTTP_OK) {
+ return null;
+ }
+ LOG.error("funtion=getVnfmById, status={}", rsp.getStatus());
+ return JSONObject.fromObject(rsp.getResponseContent());
+ }
+
+ /**
+ * Get vnfmInfo by id
+ * <br/>
+ *
+ * @param ip
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getVnfmIdByIp(String ip) {
+ RestfulResponse rsp =
+ VnfmRestfulUtil.getRemoteResponse(UrlConstant.REST_ESRINFO_GET, VnfmRestfulUtil.TYPE_GET, null);
+ if(rsp == null || rsp.getStatus() != Constant.HTTP_OK) {
+ return "";
+ }
+
+ JSONArray vnfmList = JSONArray.fromObject(rsp.getResponseContent());
+ for(int i = 0; i < vnfmList.size(); i++) {
+ if(vnfmList.getJSONObject(i).getString("url").contains(ip)) {
+ return vnfmList.getJSONObject(i).getString("vnfmId");
+ }
+ }
+
+ return "";
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtil.java
new file mode 100644
index 0000000..52235f2
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtil.java
@@ -0,0 +1,125 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.parser.ParserException;
+
+import net.sf.json.JSON;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Oct 25, 2016
+ */
+public class YamlUtil {
+ private static Logger log = LoggerFactory.getLogger(YamlUtil.class);
+
+
+
+ /**
+ *
+ * <br/>
+ *
+ * @param yamlName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static JSON yamlToJson(String yamlName){
+ Object res = parseYaml(yamlName);
+ if(res instanceof ArrayList){
+ return JSONArray.fromObject(res);
+ }
+ return JSONObject.fromObject(res);
+ }
+
+ /**
+ *
+ * <br/>
+ *
+ * @param yamlName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String loadYaml(String yamlName){
+ String res = null;
+ try {
+ Yaml yaml = new Yaml();
+ File file =new File(yamlName);
+
+ Object obj = yaml.load(new FileInputStream(file));
+ if(obj != null){
+ res = obj.toString();
+ }
+ log.debug("yaml-> "+res);
+ }catch(ParserException e){
+ log.error("error format:",e);
+ }catch(FileNotFoundException e) {
+ log.error("the yaml file not exist {}",yamlName,e);
+ }
+ return res;
+ }
+
+ /**
+ *
+ * <br/>
+ *
+ * @param yamlName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static Object parseYaml(String yamlName){
+ Object obj = null;
+ try {
+ File file =new File(yamlName);
+ obj = new Yaml().load(new FileInputStream(file));
+ }catch(ParserException e){
+ log.error("error format:",e);
+
+ }catch(FileNotFoundException e) {
+ log.error("the yaml file not exist {}",yamlName,e);
+ }
+ return obj;
+ }
+
+ public static void main(String[] args) throws IOException {
+
+
+ Map config = new Yaml().loadAs(new FileInputStream("C:\\Users\\z00292420\\Desktop\\juju\\config2.yaml"), Map.class);
+ Map options = (Map)config.get("options");
+ Map name = (Map)options.get("name");
+ name.put("default","hello,it's me");
+// new Yaml().dump(config, new FileWriter("C:\\Users\\z00292420\\Desktop\\juju\\config2.yaml"));
+ String newYaml = new Yaml().dumpAsMap(config);
+ Writer w = new FileWriter(new File("C:\\Users\\z00292420\\Desktop\\juju"));
+ w.write(newYaml);
+ w.flush();
+ w.close();
+ System.out.println(newYaml);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelp.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelp.java
new file mode 100644
index 0000000..1c0da4f
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelp.java
@@ -0,0 +1,79 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openo.baseservice.roa.util.restclient.HttpRest;
+import org.openo.baseservice.roa.util.restclient.Restful;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * Http rest help class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class HttpRestHelp {
+
+ public static final String PROTO_HTTP = "http";
+
+ private static final Logger LOG = LoggerFactory.getLogger(HttpRestHelp.class);
+
+ private static final Map<String, Restful> INSTANCES = new HashMap<>(2);
+
+ private HttpRestHelp() {
+ // constructor
+ }
+
+ private static Restful createHttpsRest(String ssloptionfile, String restoptionfile, boolean isHttps) {
+
+ HttpRest rest = new HttpRest();
+ setHttpsRestOption(rest, restoptionfile);
+ return rest;
+ }
+
+ /**
+ *
+ * Get rest instance class.<br>
+ *
+ * @param ssloptionfile
+ * @param restoptionfile
+ * @param isHttps
+ * @return
+ * @since NFVO 0.5
+ */
+ public static synchronized Restful getRestInstance(String ssloptionfile, String restoptionfile, boolean isHttps) {
+ Restful rest = INSTANCES.get(PROTO_HTTP);
+ if(null != rest) {
+ return rest;
+ }
+ rest = createHttpsRest(ssloptionfile, restoptionfile, isHttps);
+ INSTANCES.put(PROTO_HTTP, rest);
+ return rest;
+ }
+
+ private static void setHttpsRestOption(HttpRest httpRest, String restoptfile) {
+ LOG.info("setHttpsRestOption");
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelp.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelp.java
new file mode 100644
index 0000000..b1f66e9
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelp.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.jujuvnfmadapter.common.servicetoken;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openo.baseservice.roa.util.restclient.HttpRest;
+import org.openo.baseservice.roa.util.restclient.Restful;
+
+/**
+ *
+ * Http restful help class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class HttpRestfulHelp {
+
+ public static final String PROTO_HTTPS = "https";
+
+ public static final String PROTO_HTTP = "http";
+
+ private static final Map<String, Restful> INSTANCES = new HashMap<>(2);
+
+ private HttpRestfulHelp() {
+ // constructor
+ }
+
+ /**
+ *
+ * Get rest instance.<br>
+ *
+ * @param ssloptionfile
+ * @param restoptionfile
+ * @return
+ * @since NFVO 0.5
+ */
+ public static synchronized Restful getRestInstance(String ssloptionfile, String restoptionfile) {
+ Restful rest = INSTANCES.get(PROTO_HTTP);
+ if(rest != null) {
+ return rest;
+ }
+ rest = createHttpsRest(ssloptionfile, restoptionfile);
+ INSTANCES.put(PROTO_HTTP, rest);
+ return rest;
+ }
+
+ private static Restful createHttpsRest(String ssloptionfile, String restoptionfile) {
+ return new HttpRest();
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtil.java
new file mode 100644
index 0000000..238e7ad
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtil.java
@@ -0,0 +1,315 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.Restful;
+import org.openo.baseservice.roa.util.restclient.RestfulFactory;
+import org.openo.baseservice.roa.util.restclient.RestfulOptions;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * Juju VNFM restful utility class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public final class JujuVnfmRestfulUtil {
+
+ public static final String GET_TYPE = "get";
+
+ public static final String ADD_TYPE = "add";
+
+ public static final String POST_TYPE = "post";
+
+ public static final String PUT_TYPE = "put";
+
+ public static final String DEL_TYPE = "delete";
+
+ public static final String METHOD_TYPE = "methodType";
+
+ public static final int ERROR_STATUS_CODE = -1;
+
+ public static final String CONTENT_TYPE = "Content-type";
+
+ public static final String APPLICATION = "application/json";
+
+ public static final String HEADER_AUTH_TOKEN = "X-Auth-Token";
+
+ private static final Logger LOG = LoggerFactory.getLogger(JujuVnfmRestfulUtil.class);
+
+ private JujuVnfmRestfulUtil() {
+ // constructor
+ }
+
+ /**
+ *
+ * Get Vim response content.<br>
+ *
+ * @param url
+ * @param restParametes
+ * @param type
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getVimResponseContent(String url, RestfulParametes restParametes, String type) {
+ Map<String, Object> resMap = getVimResponseContent(url, restParametes, null, type);
+
+ return resMap.get("responseContent").toString();
+
+ }
+
+ /**
+ *
+ * Get Vim response content.<br>
+ *
+ * @param url
+ * @param restParametes
+ * @param opt
+ * @param type
+ * @return
+ * @since NFVO 0.5
+ */
+ public static Map<String, Object> getVimResponseContent(String url, RestfulParametes restParametes,
+ RestfulOptions opt, String type) {
+ Map<String, Object> resMap = new HashMap<>(2);
+
+ try {
+ Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+ RestfulResponse rsp = null;
+ if (rest != null) {
+ if (GET_TYPE.equals(type)) {
+ rsp = rest.get(url, restParametes, opt);
+ } else if (ADD_TYPE.equals(type)) {
+ rsp = rest.post(url, restParametes, opt);
+ } else if (PUT_TYPE.equals(type)) {
+ rsp = rest.put(url, restParametes, opt);
+ } else if (DEL_TYPE.equals(type)) {
+ rsp = rest.delete(url, restParametes, opt);
+ }
+ if (null != rsp) {
+ resMap.put("responseContent", rsp.getResponseContent());
+ resMap.put("statusCode", rsp.getStatus());
+ }
+ }
+ LOG.info("get response data success!");
+ } catch (ServiceException e) {
+ LOG.error("get response data catch exception {}.", e);
+ }
+
+ return resMap;
+ }
+
+ /**
+ *
+ * Get Vim response result.<br>
+ *
+ * @param url
+ * @param type
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getVimResponseResult(String url, String type) {
+ RestfulParametes restParametes = new RestfulParametes();
+ return getVimResponseResult(url, restParametes, type);
+ }
+
+ /**
+ *
+ * Get Vim response result.<br>
+ *
+ * @param url
+ * @param restParametes
+ * @param type
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getVimResponseResult(String url, RestfulParametes restParametes, String type) {
+ return vimRestfulResponse(url, restParametes, null, type);
+ }
+
+ /**
+ *
+ * Get Vim response.<br>
+ *
+ * @param url
+ * @param restParametes
+ * @param opt
+ * @param type
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse vimRestfulResponse(String url, RestfulParametes restParametes, RestfulOptions opt,
+ String type) {
+ RestfulResponse rsp = null;
+ try {
+ Map<String, String> headerMap = new HashMap<>(2);
+ headerMap.put(CONTENT_TYPE, APPLICATION);
+ restParametes.setHeaderMap(headerMap);
+ Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+
+ if (rest != null) {
+ if (GET_TYPE.equals(type)) {
+ rsp = rest.get(url, restParametes, opt);
+ } else if (ADD_TYPE.equals(type)) {
+ rsp = rest.post(url, restParametes, opt);
+ } else if (PUT_TYPE.equals(type)) {
+ rsp = rest.put(url, restParametes, opt);
+ } else if (DEL_TYPE.equals(type)) {
+ rsp = rest.delete(url, restParametes, opt);
+ }
+ }
+ LOG.info("get response data success!");
+ } catch (ServiceException e) {
+ LOG.error("get response data catch ServiceException {}.", e);
+ }
+ return rsp;
+ }
+
+ /**
+ *
+ * Get remote response.<br>
+ *
+ * @param paramsMap
+ * @param params
+ * @param domainTokens
+ * @param isHttps
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens,
+ boolean isHttps) {
+ String url = paramsMap.get("url");
+ String methodType = paramsMap.get(METHOD_TYPE);
+ String path = paramsMap.get("path");
+
+ RestfulResponse rsp = null;
+ Restful rest = null;
+ String sslOptionFile = "";
+ try {
+ String restClientFile = "restclient.json";
+
+ if (isHttps) {
+ sslOptionFile = "ssl.nfvo.properties";
+
+ }
+
+ rest = HttpRestHelp.getRestInstance(sslOptionFile, restClientFile, isHttps);
+
+ RestfulOptions opt = new RestfulOptions();
+ String[] strs = path.split("(http(s)?://)|:");
+
+ opt.setHost(strs[1]);
+ opt.setPort(Integer.parseInt(strs[2]));
+
+ RestfulParametes restfulParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(3);
+ headerMap.put(CONTENT_TYPE, APPLICATION);
+ headerMap.put(HEADER_AUTH_TOKEN, domainTokens);
+ restfulParametes.setHeaderMap(headerMap);
+ restfulParametes.setRawData(params);
+
+ if (rest != null) {
+ if (GET_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.get(url, restfulParametes, opt);
+ } else if (POST_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.post(url, restfulParametes, opt);
+ } else if (PUT_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.put(url, restfulParametes, opt);
+ } else if (DEL_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.delete(url, restfulParametes, opt);
+ }
+ }
+ } catch (ServiceException e) {
+ LOG.error("function=restfulResponse, get restful response catch exception {}", e);
+ }
+ return rsp;
+ }
+
+ /**
+ *
+ * Get remote response.<br>
+ *
+ * @param paramsMap
+ * @param params
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+ if(null == paramsMap){
+ return null;
+ }
+ String url = paramsMap.get("url");
+ String methodType = paramsMap.get(METHOD_TYPE);
+
+ RestfulResponse rsp = null;
+ Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+ try {
+
+ RestfulParametes restfulParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(3);
+ headerMap.put(CONTENT_TYPE, APPLICATION);
+ restfulParametes.setHeaderMap(headerMap);
+ restfulParametes.setRawData(params);
+
+ if (rest != null) {
+ if (GET_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.get(url, restfulParametes);
+ } else if (POST_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.post(url, restfulParametes);
+ } else if (PUT_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.put(url, restfulParametes);
+ } else if (DEL_TYPE.equalsIgnoreCase(methodType)) {
+ rsp = rest.delete(url, restfulParametes);
+ }
+ }
+ } catch (ServiceException e) {
+ LOG.error("function=getRemoteResponse, get restful response catch exception {}", e);
+ }
+ return rsp;
+ }
+
+ /**
+ *
+ * Generate parameter map.<br>
+ *
+ * @param url
+ * @param methodType
+ * @param path
+ * @param authMode
+ * @return
+ * @since NFVO 0.5
+ */
+ public static Map<String, String> generateParametesMap(String url, String methodType, String path,
+ String authMode) {
+ Map<String, String> paramsMap = new HashMap<>(6);
+ paramsMap.put("url", url);
+ paramsMap.put(METHOD_TYPE, methodType);
+ paramsMap.put("path", path);
+ paramsMap.put("authMode", authMode);
+ return paramsMap;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfo.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfo.java
new file mode 100644
index 0000000..4e7c13e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfo.java
@@ -0,0 +1,147 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * Vnf Authentication configuration information class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class VNFAuthConfigInfo {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VNFAuthConfigInfo.class);
+
+ private static final String AUTH_CONFIG_FILE = "identity.VNFProperties";
+
+ private static VNFAuthConfigInfo authConfig = new VNFAuthConfigInfo();
+
+ private static long lastModify = 0L;
+
+ private String vnfUserName;
+
+ private String vnfEncryptedPW;
+
+ private String vnfDomain;
+
+ private String vnfResourceDomain;
+
+ private String defaultDomain;
+
+ private VNFAuthConfigInfo() {
+ Properties vnfProp = new Properties();
+ InputStream authIn = null;
+
+ try {
+ if(isVNFProModified(getAuthCofigPath())) {
+ authIn = new FileInputStream(getAuthCofigPath());
+
+ vnfProp.load(authIn);
+ vnfUserName = vnfProp.getProperty("name");
+ vnfEncryptedPW = vnfProp.getProperty("value");
+ vnfDomain = vnfProp.getProperty("vnfDomain");
+ vnfResourceDomain = vnfProp.getProperty("vnfResourceDomain");
+ defaultDomain = vnfProp.getProperty("defaultDomain");
+ authIn.close();
+ }
+
+ } catch(IOException e) {
+ LOG.error("loadAuthConfig can't find config file>> e = {}", e);
+ } finally {
+ try {
+ if(authIn != null) {
+
+ authIn.close();
+ }
+ } catch(IOException e) {
+ LOG.error("loadAuthConfig can't find config file>> e = {}", e);
+ }
+
+ }
+
+ }
+
+ private String getAuthCofigPath() {
+ return AUTH_CONFIG_FILE;
+ }
+
+ public static VNFAuthConfigInfo getInstance() {
+ return authConfig;
+ }
+
+ public String getUserName() {
+ return vnfUserName;
+ }
+
+ public String getEncryptedPW() {
+ return vnfEncryptedPW;
+ }
+
+ public String getDomain() {
+ return vnfDomain;
+ }
+
+ public void setUserName(String vnfuserName) {
+ this.vnfUserName = vnfuserName;
+ }
+
+ public void setEncryptedPW(String vnfencryptedPW) {
+ this.vnfEncryptedPW = vnfencryptedPW;
+ }
+
+ public void setDomain(String vnfDomain) {
+ this.vnfDomain = vnfDomain;
+ }
+
+ public String getResourceDomain() {
+ return vnfResourceDomain;
+ }
+
+ public void setResourceDomain(String vnfResourceDomain) {
+ this.vnfResourceDomain = vnfResourceDomain;
+ }
+
+ public String getDefaultDomain() {
+ return defaultDomain;
+ }
+
+ public void setDefaultDomain(String defaultDomain) {
+ this.defaultDomain = defaultDomain;
+ }
+
+ private static boolean isVNFProModified(String filename) {
+ boolean returnValue = false;
+ File inputFile = new File(filename);
+ if(inputFile.lastModified() > lastModify) {
+ lastModify = inputFile.lastModified();
+ returnValue = true;
+ }
+ return returnValue;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtil.java
new file mode 100644
index 0000000..b7eee2c
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtil.java
@@ -0,0 +1,437 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.Restful;
+import org.openo.baseservice.roa.util.restclient.RestfulAsyncCallback;
+import org.openo.baseservice.roa.util.restclient.RestfulFactory;
+import org.openo.baseservice.roa.util.restclient.RestfulOptions;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.AsyncCallback;
+import org.openo.nfvo.jujuvnfmadapter.common.VnfmException;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+/**
+ *
+ * VNF Restful utility class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public final class VNFRestfulUtil {
+
+ public static final String TYPE_GET = "get";
+
+ public static final String TYPE_ADD = "add";
+
+ public static final String TYPE_POST = "post";
+
+ public static final String TYPE_PUT = "put";
+
+ public static final String TYPE_DEL = "delete";
+
+ public static final int ERROR_STATUS_CODE = -1;
+
+ private static final Logger LOG = LoggerFactory.getLogger(VNFRestfulUtil.class);
+
+ private VNFRestfulUtil() {
+
+ }
+
+ /**
+ *
+ * within our module, we support a default method to invoke.<br>
+ *
+ * @param path, rest service url
+ * @param methodNames, [post, delete, put, get, asyncPost, asyncDelete, asyncPut,asyncGet]
+ * @param bodyParam, rest body msg
+ * @return
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public static RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(2);
+ headerMap.put(Constant.CONTENT_TYPE, Constant.APPLICATION);
+ restParametes.setHeaderMap(headerMap);
+
+ if(Constant.GET.equals(methodNames) || Constant.DELETE.equals(methodNames)) {
+ if(null != bodyParam) {
+ Map<String, String> vnfparamsMap = new HashMap<>(Constant.DEFAULT_COLLECTION_SIZE);
+ if(path.contains("?")) {
+ String[] vnfUtlList = path.split("\\?");
+ String[] vnfParams = vnfUtlList[1].split("&");
+ int paramsSize = vnfParams.length;
+
+ for(int i = 0; i < paramsSize; i++) {
+ vnfparamsMap.put(vnfParams[i].split("=")[0], vnfParams[i].split("=")[1]);
+ }
+ }
+
+ String vnfParamKey;
+ Iterator<String> nameItr = bodyParam.keys();
+ while(nameItr.hasNext()) {
+ vnfParamKey = nameItr.next();
+ vnfparamsMap.put(vnfParamKey, bodyParam.get(vnfParamKey).toString());
+
+ }
+ LOG.warn("method is GET or DEL,and paramsMap = " + vnfparamsMap);
+ restParametes.setParamMap(vnfparamsMap);
+ }
+ } else {
+ restParametes.setRawData(bodyParam == null ? null : bodyParam.toString());
+ }
+ return getRestRes(methodNames, path, restParametes);
+ }
+
+ /**
+ * send restful notification to other module
+ *
+ * @param path
+ * service url
+ * @param methodName
+ * [post, delete, put, get, asyncPost, asyncDelete, asyncPut,
+ * asyncGet]
+ * @param bodyParam
+ * rest body msg
+ */
+ public static void sentEvtByRest(String path, String methodName, JSONObject bodyParam) {
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(2);
+ headerMap.put(Constant.CONTENT_TYPE, Constant.APPLICATION);
+ restParametes.setHeaderMap(headerMap);
+ restParametes.setRawData(bodyParam == null ? null : bodyParam.toString());
+ getRestRes(methodName, path, restParametes, new AsyncCallback());
+ }
+
+ /**
+ * encapsulate the java reflect exception
+ *
+ * @param methodName
+ * Restful's method
+ * @param objects
+ * method param array
+ * @return
+ */
+ private static boolean isAnyNull(Object... objects) {
+ for(int i = 0; i < objects.length; i++) {
+ if(objects[i] == null) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ private static Class<?>[] formArray(Object[] objects) {
+ Class<?>[] vnfClasses = new Class[objects.length];
+ for(int i = 0; i < objects.length; i++) {
+ vnfClasses[i] = objects[i].getClass();
+ }
+ return vnfClasses;
+
+ }
+
+ /**
+ *
+ * Get restful resource.<br>
+ *
+ * @param methodName
+ * @param objects
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getRestRes(String methodName, Object... objects) {
+ Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+ try {
+ if(isAnyNull(objects, rest)) {
+ return null;
+ }
+
+ Class<?>[] vnfClasses = formArray(objects);
+
+ if(methodName.startsWith("async")) {
+ vnfClasses[vnfClasses.length - 1] = RestfulAsyncCallback.class;
+ }
+
+ Class<?> rtType = methodName.startsWith("async") ? void.class : RestfulResponse.class;
+ MethodType mt = MethodType.methodType(rtType, vnfClasses);
+ Object reuslt = MethodHandles.lookup().findVirtual(rest.getClass(), methodName, mt).bindTo(rest)
+ .invokeWithArguments(objects);
+ if(reuslt != null) {
+ return (RestfulResponse)reuslt;
+ }
+ LOG.warn("function=getRestRes, msg: invoke Restful async {} method which return type is Void.", methodName);
+ return null;
+ } catch(ReflectiveOperationException e) {
+ LOG.error("function=getRestRes, msg=error occurs, e={}.", e);
+ } catch(ServiceException e) {
+
+ LOG.error("function=getRestRes, msg=ServiceException occurs, status={}", e.getHttpCode());
+ LOG.error("function=getRestRes, msg=ServiceException occurs, reason={}.", e.getCause().getMessage());
+ LOG.error("function=getRestRes, msg=ServiceException occurs, e={}.", e);
+ RestfulResponse response = new RestfulResponse();
+ response.setStatus(e.getHttpCode());
+ response.setResponseJson(e.getCause().getMessage());
+ return response;
+
+ } catch(Throwable e) {//NOSONAR
+ try {
+ throw (VnfmException)new VnfmException().initCause(e.getCause());
+ } catch(VnfmException e1) {
+ LOG.error("function=getRestRes, msg=VnfmException occurs, e={},e1={}.", e1, e);
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ *
+ * Send request to application.<br>
+ *
+ * @param path
+ * @param methodName
+ * @param paraJson
+ * @return
+ * @since NFVO 0.5
+ */
+ public static JSONObject sendReqToApp(String path, String methodName, JSONObject paraJson) {
+ JSONObject retJson = new JSONObject();
+ retJson.put(Constant.RETURN_CODE, Constant.REST_FAIL);
+ String abPath = null;
+ String vnfmId = null;
+ if(paraJson != null && paraJson.containsKey("vnfmInfo")) {
+ JSONObject vnfmObj = paraJson.getJSONObject("vnfmInfo");
+ vnfmId = vnfmObj.getString("id");
+ } else {
+ abPath = path;
+ }
+ LOG.warn("function=sendReqToApp, msg=url to send to app is: " + abPath);
+
+ RestfulResponse restfulResponse = VNFRestfulUtil.getRestResByDefault(path, methodName, paraJson);
+ if(restfulResponse == null || abPath == null) {
+ LOG.error("function=sendReqToApp, msg=data from app is null");
+ retJson.put("data", "get null result");
+ } else if(restfulResponse.getStatus() == Constant.HTTP_OK) {
+ JSONObject object = JSONObject.fromObject(restfulResponse.getResponseContent());
+ if(!abPath.contains("vnfdmgr/v1")) {
+ LOG.warn("function=sendReqToApp, msg=result from app is: " + object.toString());
+ }
+ if(object.getInt(Constant.RETURN_CODE) == Constant.REST_SUCCESS) {
+ retJson.put(Constant.RETURN_CODE, Constant.REST_SUCCESS);
+ retJson.put("data", withVnfmIdSuffix(vnfmId, object.get("data")));
+ return retJson;
+ } else {
+ retJson.put(Constant.RETURN_CODE, Constant.REST_FAIL);
+ if(object.containsKey("msg")) {
+ retJson.put("data", object.getString("msg"));
+ return retJson;
+ } else {
+ return object;
+ }
+ }
+ } else {
+ LOG.error("function=sendReqToApp, msg=status from app is: " + restfulResponse.getStatus());
+ LOG.error("function=sendReqToApp, msg=result from app is: " + restfulResponse.getResponseContent());
+ retJson.put("data", "send to app get error status: " + restfulResponse.getStatus());
+ }
+ return retJson;
+ }
+
+ /**
+ * append suffix to result with vnfmId
+ *
+ * @param vnfmId
+ * @param dataJson
+ * @return
+ */
+ private static Object withVnfmIdSuffix(String vnfmId, Object dataJson) {
+ Object result = new Object();
+ if(vnfmId == null) {
+ return dataJson;
+ }
+
+ if(dataJson instanceof JSONObject) {
+ JSONObject jsonObject = (JSONObject)dataJson;
+ jsonObject.put("vnfmId", vnfmId);
+ result = jsonObject;
+ } else if(dataJson instanceof JSONArray) {
+ JSONArray dataArray = (JSONArray)dataJson;
+ JSONArray resultArray = new JSONArray();
+
+ for(Object obj : dataArray) {
+ JSONObject jsonObject = JSONObject.fromObject(obj);
+ jsonObject.put("vnfmId", vnfmId);
+ resultArray.add(jsonObject);
+ }
+ result = resultArray;
+ }
+ return result;
+ }
+
+ /**
+ *
+ * Get remote response.<br>
+ *
+ * @param paramsMap
+ * @param params
+ * @param domainTokens
+ * @param isNfvoApp
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens,
+ boolean isNfvoApp) {
+ String utilUrl = paramsMap.get("url");
+ String utilMethodType = paramsMap.get(Constant.METHOD_TYPE);
+ String utilPath = paramsMap.get("path");
+ String authMode = paramsMap.get(Constant.AUTH_MODE);
+
+ RestfulResponse rsp = null;
+ Restful rest = null;
+ String sslOptionFile = "";
+ try {
+ String restClientFile = "restclient.json";
+
+ if(isNfvoApp) {
+ sslOptionFile = "ssl.nfvo.properties";
+ } else {
+ sslOptionFile = "ssl.vcmm.properties";
+ }
+
+ LOG.warn("function=getRemoteResponse,AuthenticationMode=" + authMode);
+
+ rest = HttpRestfulHelp.getRestInstance(sslOptionFile, restClientFile);
+
+ RestfulOptions opt = new RestfulOptions();
+ String[] strs = utilPath.split("(http(s)?://)|:");
+
+ opt.setHost(strs[1]);
+ opt.setPort(Integer.parseInt(strs[2]));
+
+ RestfulParametes restfulParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(3);
+ headerMap.put(Constant.CONTENT_TYPE, Constant.APPLICATION);
+ headerMap.put(Constant.HEADER_AUTH_TOKEN, domainTokens);
+ restfulParametes.setHeaderMap(headerMap);
+ restfulParametes.setRawData(params);
+
+ if(rest != null) {
+ if(TYPE_GET.equalsIgnoreCase(utilMethodType)) {
+ rsp = rest.get(utilUrl, restfulParametes, opt);
+ } else if(TYPE_POST.equalsIgnoreCase(utilMethodType)) {
+ rsp = rest.post(utilUrl, restfulParametes, opt);
+ } else if(TYPE_PUT.equalsIgnoreCase(utilMethodType)) {
+ rsp = rest.put(utilUrl, restfulParametes, opt);
+ } else if(TYPE_DEL.equalsIgnoreCase(utilMethodType)) {
+ rsp = rest.delete(utilUrl, restfulParametes, opt);
+ }
+ }
+ } catch(ServiceException e) {
+ LOG.error("function=restfulResponse, get restful response catch exception {}", e);
+ }
+ return rsp;
+ }
+
+ /**
+ *
+ * Generate parameters map.<br>
+ *
+ * @param url
+ * @param methodType
+ * @param path
+ * @param authMode
+ * @return
+ * @since NFVO 0.5
+ */
+ public static Map<String, String> generateParamsMap(String url, String methodType, String path, String authMode) {
+ Map<String, String> utilParamsMap = new HashMap<>(6);
+ utilParamsMap.put("url", url);
+ utilParamsMap.put("methodType", methodType);
+ utilParamsMap.put("path", path);
+ utilParamsMap.put("authMode", authMode);
+ return utilParamsMap;
+ }
+
+ /**
+ *
+ * Generate parameters map.<br>
+ *
+ * @param url
+ * @param methodType
+ * @param path
+ * @return
+ * @since NFVO 0.5
+ */
+ public static Map<String, String> generateParamsMap(String url, String methodType, String path) {
+ Map<String, String> paramsMap = new HashMap<>(6);
+ paramsMap.put("url", url);
+ paramsMap.put("methodType", methodType);
+ paramsMap.put("path", path);
+ paramsMap.put("authMode", "Certificate");
+ return paramsMap;
+ }
+
+ /**
+ *
+ * Get result to vnfm.<br>
+ *
+ * @param vnfmInfo
+ * @param vnfmId
+ * @return
+ * @since NFVO 0.5
+ */
+ public static JSONObject getResultToVnfm(JSONObject vnfmInfo, String vnfmId) {
+ JSONObject retJson = new JSONObject();
+ retJson.put(Constant.RETURN_CODE, Constant.REST_FAIL);
+ if(vnfmInfo == null) {
+ LOG.error("function=getResultToVnfm, msg=data from vnfm is null");
+ retJson.put("data", "get null result");
+ return retJson;
+ }
+
+ if(vnfmInfo.getInt(Constant.RETURN_CODE) == Constant.REST_SUCCESS) {
+ retJson.put(Constant.RETURN_CODE, Constant.REST_SUCCESS);
+ retJson.put("data", withVnfmIdSuffix(vnfmId, vnfmInfo.get("data")));
+ return retJson;
+ } else {
+ retJson.put(Constant.RETURN_CODE, Constant.REST_FAIL);
+ if(vnfmInfo.containsKey("msg")) {
+ retJson.put("data", vnfmInfo.getString("msg"));
+ return retJson;
+ } else {
+ return vnfmInfo;
+ }
+ }
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtil.java
new file mode 100644
index 0000000..3e3f793
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtil.java
@@ -0,0 +1,401 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.Restful;
+import org.openo.baseservice.roa.util.restclient.RestfulAsyncCallback;
+import org.openo.baseservice.roa.util.restclient.RestfulFactory;
+import org.openo.baseservice.roa.util.restclient.RestfulOptions;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.VnfmException;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ */
+public final class VnfmRestfulUtil {
+
+ public static final String TYPE_GET = "get";
+
+ public static final String TYPE_ADD = "add";
+
+ public static final String TYPE_POST = "post";
+
+ public static final String TYPE_PUT = "put";
+
+ public static final String TYPE_DEL = "delete";
+
+ public static final int ERROR_STATUS_CODE = -1;
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfmRestfulUtil.class);
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ */
+ private VnfmRestfulUtil() {
+ // Default Constructor
+ }
+
+ /**
+ * within our module, we support a default method to invoke
+ *
+ * @param path
+ * rest service url
+ * @param methodNames
+ * [post, delete, put, get, asyncPost, asyncDelete, asyncPut,
+ * asyncGet]
+ * @param bodyParam
+ * rest body msg
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public static RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(2);
+ headerMap.put(Constant.CONTENT_TYPE, Constant.APPLICATION);
+ restParametes.setHeaderMap(headerMap);
+
+ if(Constant.GET.equals(methodNames) || Constant.DELETE.equals(methodNames)) {
+ if(null != bodyParam) {
+ Map<String, String> vnfParamsMap = new HashMap<>(Constant.DEFAULT_COLLECTION_SIZE);
+ if(path.contains("?")) {
+ String[] vnfUtlList = path.split("\\?");
+ String[] vnfParams = vnfUtlList[1].split("&");
+ int paramsSize = vnfParams.length;
+
+ for(int i = 0; i < paramsSize; i++) {
+ vnfParamsMap.put(vnfParams[i].split("=")[0], vnfParams[i].split("=")[1]);
+ }
+ }
+
+ String vnfParamKey = null;
+ Iterator<String> nameItr = bodyParam.keys();
+ while(nameItr.hasNext()) {
+ vnfParamKey = nameItr.next();
+ vnfParamsMap.put(vnfParamKey, bodyParam.get(vnfParamKey).toString());
+
+ }
+ LOG.warn("method is GET or DEL,and paramsMap = " + vnfParamsMap);
+ restParametes.setParamMap(vnfParamsMap);
+ }
+ } else {
+ restParametes.setRawData(bodyParam == null ? null : bodyParam.toString());
+ }
+ return getRestRes(methodNames, path, restParametes);
+ }
+
+ /**
+ * encapsulate the java reflect exception
+ *
+ * @param objects
+ * method param array
+ * @return
+ */
+ private static boolean isAnyNull(Object... objects) {
+ for(int i = 0; i < objects.length; i++) {
+ if(objects[i] == null) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ private static Class<?>[] formArray(Object[] objects) {
+ Class<?>[] vnfclasses = new Class[objects.length];
+ for(int i = 0; i < objects.length; i++) {
+ vnfclasses[i] = objects[i].getClass();
+ }
+ return vnfclasses;
+
+ }
+
+ /**
+ * <br>
+ *
+ * @param methodName
+ * @param objects
+ * @return
+ */
+ public static RestfulResponse getRestRes(String methodName, Object... objects) {
+ Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+ try {
+ if(isAnyNull(objects, rest)) {
+ return null;
+ }
+
+ Class<?>[] vnfClasses = formArray(objects);
+
+ if(methodName.startsWith("async")) {
+ vnfClasses[vnfClasses.length - 1] = RestfulAsyncCallback.class;
+ }
+
+ Class<?> rtType = methodName.startsWith("async") ? void.class : RestfulResponse.class;
+ MethodType mt = MethodType.methodType(rtType, vnfClasses);
+ Object reuslt = MethodHandles.lookup().findVirtual(rest.getClass(), methodName, mt).bindTo(rest)
+ .invokeWithArguments(objects);
+ if(reuslt != null) {
+ return (RestfulResponse)reuslt;
+ }
+ LOG.warn("function=getRestRes, msg: invoke Restful async {} method which return type is Void.", methodName);
+ return null;
+ } catch(ReflectiveOperationException e) {
+ LOG.error("function=getRestRes, msg=error occurs, e={}.", e);
+ } catch(ServiceException e) {
+
+ LOG.error("function=getRestRes, msg=ServiceException occurs, status={}", e.getHttpCode());
+ LOG.error("function=getRestRes, msg=ServiceException occurs, reason={}.", e.getCause().getMessage());
+ LOG.error("function=getRestRes, msg=ServiceException occurs, e={}.", e);
+ RestfulResponse response = new RestfulResponse();
+ response.setStatus(e.getHttpCode());
+ response.setResponseJson(e.getCause().getMessage());
+ return response;
+
+ } catch(Throwable e) {//NOSONAR
+ try {
+ throw (VnfmException)new VnfmException().initCause(e.getCause());
+ } catch(VnfmException e1) {
+ LOG.error("function=getRestRes, msg=VnfmException occurs, e={},e1={}.", e1, e);
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * <br>
+ *
+ * @param path
+ * @param methodName
+ * @param paraJson
+ * @return
+ */
+ public static JSONObject sendReqToApp(String path, String methodName, JSONObject paraJson) {
+ JSONObject retJson = new JSONObject();
+ retJson.put(Constant.RETURN_CODE, Constant.REST_FAIL);
+ String abPath = null;
+ String vnfmId = null;
+ if(paraJson != null && paraJson.containsKey("vnfmInfo")) {
+ JSONObject vnfmObj = paraJson.getJSONObject("vnfmInfo");
+ vnfmId = vnfmObj.getString("id");
+ } else {
+ abPath = path;
+ }
+ LOG.warn("function=sendReqToApp, msg=url to send to app is: " + abPath);
+
+ RestfulResponse restfulResponse = VnfmRestfulUtil.getRestResByDefault(path, methodName, paraJson);
+ if(restfulResponse == null || abPath == null) {
+ LOG.error("function=sendReqToApp, msg=data from app is null");
+ retJson.put("data", "get null result");
+ } else if(restfulResponse.getStatus() == Constant.HTTP_OK) {
+ JSONObject object = JSONObject.fromObject(restfulResponse.getResponseContent());
+ if(!abPath.contains("vnfdmgr/v1")) {
+ LOG.warn("function=sendReqToApp, msg=result from app is: " + object.toString());
+ }
+ if(object.getInt(Constant.RETURN_CODE) == Constant.REST_SUCCESS) {
+ retJson.put(Constant.RETURN_CODE, Constant.REST_SUCCESS);
+ retJson.put("data", withVnfmIdSuffix(vnfmId, object.get("data")));
+ return retJson;
+ } else {
+ retJson.put(Constant.RETURN_CODE, Constant.REST_FAIL);
+ if(object.containsKey("msg")) {
+ retJson.put("data", object.getString("msg"));
+ return retJson;
+ } else {
+ return object;
+ }
+ }
+ } else {
+ LOG.error("function=sendReqToApp, msg=status from app is: " + restfulResponse.getStatus());
+ LOG.error("function=sendReqToApp, msg=result from app is: " + restfulResponse.getResponseContent());
+ retJson.put("data", "send to app get error status: " + restfulResponse.getStatus());
+ }
+ return retJson;
+ }
+
+ /**
+ * append suffix to result with vnfmId
+ *
+ * @param vnfmId
+ * @param dataJson
+ * @return
+ */
+ private static Object withVnfmIdSuffix(String vnfmId, Object dataJson) {
+ Object result = new Object();
+ if(vnfmId == null) {
+ return dataJson;
+ }
+
+ if(dataJson instanceof JSONObject) {
+ JSONObject jsonObject = (JSONObject)dataJson;
+ jsonObject.put("vnfmId", vnfmId);
+ result = jsonObject;
+ } else if(dataJson instanceof JSONArray) {
+ JSONArray dataArray = (JSONArray)dataJson;
+ JSONArray resultArray = new JSONArray();
+
+ for(Object obj : dataArray) {
+ JSONObject jsonObject = JSONObject.fromObject(obj);
+ jsonObject.put("vnfmId", vnfmId);
+ resultArray.add(jsonObject);
+ }
+ result = resultArray;
+ }
+ return result;
+ }
+ /**
+ *
+ * Method to get Remote Response.<br/>
+ *
+ * @param paramsMap
+ * @param params
+ * @param domainTokens
+ * @param isHttps
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ String path = paramsMap.get("path");
+ String methodType = paramsMap.get(Constant.METHOD_TYPE);
+ String url = paramsMap.get("url");
+
+ RestfulResponse rsp = null;
+ Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+ try {
+
+ RestfulOptions opt = new RestfulOptions();
+ String[] strs = url.split("(http(s)?://)|:|/");
+
+ opt.setHost(strs[1]);
+ if(strs.length > 0){
+ opt.setPort(Integer.parseInt(strs[2]));
+ }else{
+ opt.setPort(80);
+ }
+
+ for(int i=strs.length-1;i>=0;i--){
+ if(i > 2){
+ path = "/"+strs[i]+path;
+ }
+ }
+ LOG.info("restfull options:"+EntityUtils.toString(opt, RestfulOptions.class));
+ RestfulParametes restfulParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(3);
+ headerMap.put(Constant.CONTENT_TYPE, Constant.APPLICATION);
+ headerMap.put(Constant.HEADER_AUTH_TOKEN, domainTokens);
+ restfulParametes.setHeaderMap(headerMap);
+ restfulParametes.setRawData(params);
+
+ if(rest != null) {
+ if(TYPE_GET.equalsIgnoreCase(methodType)) {
+ rsp = rest.get(path, restfulParametes, opt);
+ } else if(TYPE_POST.equalsIgnoreCase(methodType)) {
+ rsp = rest.post(path, restfulParametes, opt);
+ } else if(TYPE_PUT.equalsIgnoreCase(methodType)) {
+ rsp = rest.put(path, restfulParametes, opt);
+ } else if(TYPE_DEL.equalsIgnoreCase(methodType)) {
+ rsp = rest.delete(path, restfulParametes, opt);
+ }
+ }
+ } catch(ServiceException e) {
+ LOG.error("function=getRemoteResponse, get restful response catch exception {}", e);
+ }
+ LOG.info("request :{},response:{}",params,EntityUtils.toString(rsp, RestfulResponse.class));
+ return rsp;
+ }
+
+
+ /**
+ * read DEFAULT config
+ * <br/>
+ *
+ * @param url
+ * @param methodType
+ * @param params
+ * @return
+ * @since NFVO 0.5
+ */
+ public static RestfulResponse getRemoteResponse(String url, String methodType, String params) {
+ RestfulResponse rsp = null;
+ Restful rest = RestfulFactory.getRestInstance(RestfulFactory.PROTO_HTTP);
+ try {
+
+ RestfulParametes restfulParametes = new RestfulParametes();
+ Map<String, String> headerMap = new HashMap<>(3);
+ headerMap.put(Constant.CONTENT_TYPE, Constant.APPLICATION);
+ restfulParametes.setHeaderMap(headerMap);
+ if(params != null) {
+ restfulParametes.setRawData(params);
+ }
+
+ if(rest != null) {
+ if(TYPE_GET.equalsIgnoreCase(methodType)) {
+ rsp = rest.get(url, restfulParametes);
+ } else if(TYPE_POST.equalsIgnoreCase(methodType)) {
+ rsp = rest.post(url, restfulParametes);
+ } else if(TYPE_PUT.equalsIgnoreCase(methodType)) {
+ rsp = rest.put(url, restfulParametes);
+ } else if(TYPE_DEL.equalsIgnoreCase(methodType)) {
+ rsp = rest.delete(url, restfulParametes);
+ }
+ }
+ } catch(ServiceException e) {
+ LOG.error("function=getRemoteResponse, get restful response catch exception {}", e);
+ }
+ return rsp;
+ }
+
+ /**
+ * <br>
+ *
+ * @param url
+ * @param methodType
+ * @param path
+ * @param authMode
+ * @return Map<String, String>
+ */
+ public static Map<String, String> generateParamsMap(String url, String methodType, String path, String authMode) {
+ Map<String, String> utilParamsMap = new HashMap<>(6);
+ utilParamsMap.put("url", url);
+ utilParamsMap.put(Constant.METHOD_TYPE, methodType);
+ utilParamsMap.put("path", path);
+ utilParamsMap.put("authMode", authMode);
+ return utilParamsMap;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokens.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokens.java
new file mode 100644
index 0000000..edbfd05
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokens.java
@@ -0,0 +1,136 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken.module;
+
+import net.sf.json.JSONObject;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.VNFJsonUtil;
+
+/**
+ *
+ * Access tokens class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class AccessTokens {
+
+ private String accesTokens;
+
+ private int expire;
+
+ private long createTime;
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @since NFVO 0.5
+ */
+ public AccessTokens() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param token
+ * @param ttl
+ * @since NFVO 0.5
+ */
+ public AccessTokens(String token, int ttl) {
+ this.accesTokens = token;
+ this.expire = ttl;
+ this.createTime = System.currentTimeMillis();
+ }
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param accessToken
+ * @param expire
+ * @param createTime
+ * @since NFVO 0.5
+ */
+ public AccessTokens(String accessToken, Integer expire, Long createTime) {
+ this.accesTokens = accessToken;
+ this.expire = expire == null ? 0 : expire;
+ this.createTime = createTime == null ? 0 : createTime;
+ }
+
+ public String getAccessToken() {
+ return this.accesTokens;
+ }
+
+ public void setAccessToken(String token) {
+ this.accesTokens = token;
+ }
+
+ public int getExpire() {
+ return this.expire;
+ }
+
+ public long getCreateTime() {
+ return this.createTime;
+ }
+
+ /**
+ *
+ * Check time validity.<br>
+ *
+ * @return
+ * @since NFVO 0.5
+ */
+ public boolean valid() {
+ if(this.expire == 0) {
+ return true;
+ }
+ return System.currentTimeMillis() - this.createTime <= 1000L * this.expire;
+ }
+
+ @Override
+ public String toString() {
+ return '{'+ StringUtils.trimToEmpty(this.getAccessToken()) + '\'' + ",'expire': '" + this.getExpire() + '\'' +
+ ",'createTime': '" + this.getCreateTime() + '\'' + '}';
+ }
+
+ /**
+ *
+ * To entity.<br>
+ *
+ * @param jsonObject
+ * @return
+ * @since NFVO 0.5
+ */
+ public static AccessTokens toEntity(JSONObject jsonObject) {
+ String token = VNFJsonUtil.getJsonFieldStr(jsonObject, "accessToken");
+ Integer expire = VNFJsonUtil.getJsonFieldInt(jsonObject, "expire");
+ Long createTime = VNFJsonUtil.getJsonFieldLong(jsonObject, "createTime");
+ return new AccessTokens(token, expire, createTime);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessor.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessor.java
new file mode 100644
index 0000000..3013150
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessor.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.jujuvnfmadapter.service.activator;
+
+import org.openo.nfvo.jujuvnfmadapter.service.api.internalsvc.inf.IJujuAdapterMgrService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * ROA juju service post processor class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class ROAJujuServicePostProcessor implements DestructionAwareBeanPostProcessor{
+ private static final Logger LOG = LoggerFactory.getLogger(ROAJujuServicePostProcessor.class);
+
+ @Override
+ public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
+ if(bean instanceof IJujuAdapterMgrService){
+ IJujuAdapterMgrService jujuAdapterSvc = (IJujuAdapterMgrService)bean;
+ jujuAdapterSvc.register();
+ LOG.info("Successfully Registered to Microservice BUS!", ROAJujuServicePostProcessor.class);
+ }
+
+ return bean;
+ }
+
+ @Override
+ public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
+ // TODO Auto-generated method stub
+ return bean;
+ }
+
+ @Override
+ public void postProcessBeforeDestruction(Object bean, String name) throws BeansException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManager.java
new file mode 100644
index 0000000..5dc8184
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManager.java
@@ -0,0 +1,302 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.impl;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
+import org.openo.nfvo.jujuvnfmadapter.common.DownloadCsarManager;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.JujuVnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IResourceManager;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import net.sf.json.JSONObject;
+
+/**
+ *
+ * Adapter resource manager class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+@Service
+public class AdapterResourceManager implements IResourceManager {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AdapterResourceManager.class);
+
+
+ @Override
+ public JSONObject getJujuVnfmInfo(Map<String, String> paramsMap) {
+ JSONObject resultObj = new JSONObject();
+ //verify url,reserve
+
+ RestfulResponse rsp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap,"");
+ if(null == rsp) {
+ LOG.error("function=getJujuVnfmInfo, RestfulResponse is null");
+ resultObj.put(Constant.REASON, "RestfulResponse is null.");
+ resultObj.put(Constant.RETURN_CODE, Constant.ERROR_STATUS_CODE);
+ return resultObj;
+ }
+ String resultCreate = rsp.getResponseContent();
+
+ if(rsp.getStatus() == Constant.HTTP_OK) {
+ LOG.warn("function=getJujuVnfmInfo, msg= status={}, result={}.", rsp.getStatus(), resultCreate);
+ resultObj = JSONObject.fromObject(resultCreate);
+ resultObj.put(Constant.RETURN_CODE, Constant.HTTP_OK);
+ return resultObj;
+ } else {
+ LOG.error("function=getJujuVnfmInfo, msg=ESR return fail,status={}, result={}.", rsp.getStatus(),
+ resultCreate);
+ resultObj.put(Constant.REASON, "ESR return fail.");
+ }
+ resultObj.put(Constant.RETURN_CODE, Constant.ERROR_STATUS_CODE);
+ return resultObj;
+ }
+
+ @Override
+ public JSONObject getVnfdInfo(String csarId) {
+ JSONObject resultObj = new JSONObject();
+ JSONObject csarPkgInfoObj = new JSONObject();
+
+ if(null == csarId || "".equals(csarId)) {
+ resultObj.put("reason", "csarId is null.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+ String downloadUri = this.fetchDownloadUrlFromCatalog(csarId);
+ if(downloadUri == null){
+ LOG.error("fetchDownloadUrlFromCatalog return null,csarId="+csarId);
+ resultObj.put(Constant.REASON, "fetchDownloadUrlFromCatalog is null.");
+ resultObj.put(Constant.RETURN_CODE, Constant.ERROR_STATUS_CODE);
+ return resultObj;
+ }
+ String csarPkgInfo;
+ try {
+ csarPkgInfo = readCsarPkgInfo();
+ csarPkgInfoObj = JSONObject.fromObject(csarPkgInfo); //NOSONAR
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ String csarfilepath = csarPkgInfoObj.getString("csar_file_path");
+ String csarfilename = csarPkgInfoObj.getString("csar_file_name");
+
+ // download csar package and save in location.
+ JSONObject downloadObject = downloadCsar(downloadUri, csarfilepath+ System.getProperty("file.separator") +csarfilename);
+
+ if (Integer.valueOf(downloadObject.get("retCode").toString()) != Constant.REST_SUCCESS) {
+ LOG.error("download CSAR fail.", downloadObject.get("retCode"));
+ resultObj.put("reason", downloadObject.get("reason").toString());
+ resultObj.put("retCode", downloadObject.get("retCode").toString());
+ return resultObj;
+ }
+ LOG.info("download CSAR successful.", downloadObject.get("retCode"));
+
+ // unzip csar package to location.
+ JSONObject unzipObject = unzipCSAR(csarfilepath+ System.getProperty("file.separator") +csarfilename, csarfilepath);
+
+ if (Integer.valueOf(unzipObject.get("retCode").toString()) != Constant.REST_SUCCESS) {
+ LOG.error("unzip CSAR fail.", unzipObject.get("retCode"));
+ resultObj.put("reason", unzipObject.get("reason").toString());
+ resultObj.put("retCode", unzipObject.get("retCode").toString());
+ return resultObj;
+ }
+ LOG.info("unzip CSAR successful.", unzipObject.get("retCode"));
+
+ resultObj.put(Constant.RETURN_CODE, Constant.HTTP_OK);
+ resultObj.put("csarFilePath", getImagesPath(csarfilepath));
+
+ return resultObj;
+ }
+ private String getImagesPath(String csarfilepath){
+ File imageFile = new File(csarfilepath+"SoftwareImages");
+ if(imageFile.exists()){
+ File[] charmFiles = imageFile.listFiles();
+ for(File file : charmFiles){
+ if(!file.getName().endsWith(".zip")){
+ return file.getAbsolutePath()+"/";
+ }
+ }
+ }
+ return csarfilepath;
+ }
+
+ public String fetchDownloadUrlFromCatalog(String csarId){
+ String downloadUri = null;
+ try {
+ Map paramsMap = new HashMap();
+
+ paramsMap.put("url", String.format(UrlConstant.REST_CSARINFO_GET, csarId));
+ paramsMap.put("methodType", Constant.GET);
+
+ RestfulResponse rsp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap,"");
+ if(null == rsp) {
+ LOG.error("function=getVnfdInfo, RestfulResponse is null");
+ return null;
+ }
+ String resultCreate = rsp.getResponseContent();
+
+ if(rsp.getStatus() != Constant.HTTP_OK) {
+ LOG.error("function=getVnfdInfo, msg=catalog return fail,status={}, result={}.", rsp.getStatus(),
+ resultCreate);
+ return null;
+ }
+ JSONObject csarObj = JSONObject.fromObject(resultCreate);
+ downloadUri = csarObj.getString("downloadUri");
+ } catch (Exception e) {
+ LOG.error("fetchDownloadUrlFromCatalog error",e);
+ }
+ return downloadUri;
+ }
+
+ /**
+ * Get csar package information.<br>
+ *
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public static String readCsarPkgInfo() throws IOException {
+ InputStream ins = null;
+ BufferedInputStream bins = null;
+ String fileContent = "";
+
+ String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator")
+ + "etc" + System.getProperty("file.separator") + "csarInfo" + System.getProperty("file.separator")
+ + Constant.CSARINFO;
+
+ try {
+ ins = new FileInputStream(fileName);
+ bins = new BufferedInputStream(ins);
+
+ byte[] contentByte = new byte[ins.available()];
+ int num = bins.read(contentByte);
+
+ if (num > 0) {
+ fileContent = new String(contentByte);
+ }
+ } catch (FileNotFoundException e) {
+ LOG.error(fileName + "is not found!", e);
+ } finally {
+ if (ins != null) {
+ ins.close();
+ }
+ if (bins != null) {
+ bins.close();
+ }
+ }
+ return fileContent;
+ }
+
+ /**
+ * download CSAR.<br>
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public JSONObject downloadCsar(String url, String filePath) {
+ JSONObject resultObj = new JSONObject();
+
+ if(url == null || "".equals(url)) {
+ resultObj.put("reason", "url is null.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+ if(filePath == null || "".equals(filePath)) {
+ resultObj.put("reason", "downloadUrl filePath is null.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+
+ String status = DownloadCsarManager.download(url, filePath);
+
+ if (Constant.DOWNLOADCSAR_SUCCESS.equals(status)) {
+ resultObj.put("reason", "download csar file successfully.");
+ resultObj.put("retCode", Constant.REST_SUCCESS);
+ } else {
+ resultObj.put("reason", "download csar file failed.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ }
+ return resultObj;
+ }
+
+ /*
+ * unzip CSAR packge
+ * @param fileName filePath
+ * @return
+ */
+ public JSONObject unzipCSAR(String fileName,String filePath) {
+ JSONObject resultObj = new JSONObject();
+
+ if(fileName == null || "".equals(fileName)) {
+ resultObj.put("reason", "fileName is null.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+ if(filePath == null || "".equals(filePath)) {
+ resultObj.put("reason", "unzipCSAR filePath is null.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+
+ int status = DownloadCsarManager.unzipCSAR(fileName, filePath);
+
+
+ if (Constant.UNZIP_SUCCESS == status) {
+ resultObj.put("reason", "unzip csar file successfully.");
+ resultObj.put("retCode", Constant.REST_SUCCESS);
+ chmodToFiles(filePath);
+ } else {
+ resultObj.put("reason", "unzip csar file failed.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ }
+ return resultObj;
+ }
+
+
+
+private void chmodToFiles(String filePath) {
+ try {
+ List<String> commands = new ArrayList<String>();
+ commands.add("chmod");
+ commands.add("-R");
+ commands.add("777");
+ commands.add(filePath);
+ EntityUtils.ExeRes exeRes = EntityUtils.execute(null, commands);
+ if (exeRes.getCode() == EntityUtils.ExeRes.SUCCESS) {
+ LOG.info("chmod success:" + EntityUtils.formatCommand(commands));
+ } else {
+ LOG.error("dchmod fail" + EntityUtils.formatCommand(commands) + "\n" + exeRes);
+ }
+ } catch (Exception e) {
+ LOG.error("chmod error:",e);
+ }
+}
+}
+
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManager.java
new file mode 100644
index 0000000..a9680ff
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2DriverManager.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.adapter.impl;
+
+import net.sf.json.JSONObject;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.JujuVnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IJujuAdapter2DriverManager;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Jan 24, 2017
+ */
+public class JujuAdapter2DriverManager implements IJujuAdapter2DriverManager {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JujuAdapter2DriverManager.class);
+
+ @Override
+ public JSONObject registerDriver(Map<String, String> paramsMap, JSONObject driverInfo) {
+ JSONObject resultObj = new JSONObject();
+
+ RestfulResponse rsp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap, driverInfo.toString());
+ if(null == rsp) {
+ LOG.error("function=registerDriver, RestfulResponse is null");
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+ String resultCreate = rsp.getResponseContent();
+
+ if(rsp.getStatus() == Constant.HTTP_CREATED) {
+ LOG.warn("function=registerDriver, msg= status={}, result={}.", rsp.getStatus(), resultCreate);
+ resultObj = JSONObject.fromObject(resultCreate);
+ resultObj.put("retCode", Constant.HTTP_CREATED);
+ return resultObj;
+ } else if(rsp.getStatus() == Constant.INVALID_PARAMETERS) {
+ LOG.error("function=registerDriver, msg=DriverManager return fail,invalid parameters,status={}, result={}.",
+ rsp.getStatus(), resultCreate);
+ resultObj.put("reason", "DriverManager return fail,invalid parameters.");
+ } else if(rsp.getStatus() == Constant.HTTP_INNERERROR) {
+ LOG.error(
+ "function=registerDriver, msg=DriverManager return fail,internal system error,status={}, result={}.",
+ rsp.getStatus(), resultCreate);
+ resultObj.put("reason", "DriverManager return fail,internal system error.");
+ }
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+
+ @Override
+ public JSONObject unregisterDriver(Map<String, String> paramsMap) {
+ JSONObject resultObj = new JSONObject();
+
+ RestfulResponse rsp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap, "");
+ if(null == rsp) {
+ LOG.error("function=unregisterDriver, RestfulResponse is null");
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+ String resultCreate = rsp.getResponseContent();
+
+ if(rsp.getStatus() == Constant.UNREG_SUCCESS) {
+ LOG.warn("function=unregisterDriver, msg= status={}, result={}.", rsp.getStatus(), resultCreate);
+ resultObj = JSONObject.fromObject(resultCreate);
+ resultObj.put("retCode", Constant.UNREG_SUCCESS);
+ return resultObj;
+ } else if(rsp.getStatus() == Constant.HTTP_NOTFOUND) {
+ LOG.error(
+ "function=unregisterDriver, msg=DriverManager return fail,can't find the service instance.status={}, result={}.",
+ rsp.getStatus(), resultCreate);
+ resultObj.put("reason", "DriverManager return fail,can't find the service instance.");
+ } else if(rsp.getStatus() == Constant.INVALID_PARAMETERS) {
+ LOG.error(
+ "function=unregisterDriver, msg=DriverManager return fail,invalid parameters,status={}, result={}.",
+ rsp.getStatus(), resultCreate);
+ resultObj.put("reason", "DriverManager return fail,invalid parameters.");
+ } else if(rsp.getStatus() == Constant.HTTP_INNERERROR) {
+ LOG.error(
+ "function=unregisterDriver, msg=DriverManager return fail,internal system error,status={}, result={}.",
+ rsp.getStatus(), resultCreate);
+ resultObj.put("reason", "DriverManager return fail,internal system error.");
+ }
+ resultObj.put("retCode", Constant.REST_FAIL);
+ return resultObj;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManager.java
new file mode 100644
index 0000000..0a96792
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManager.java
@@ -0,0 +1,110 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.impl;
+
+import java.util.Map;
+
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.JujuVnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IJujuAdapter2MSBManager;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ *
+ * Juju adapter to msb manager class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class JujuAdapter2MSBManager implements IJujuAdapter2MSBManager {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JujuAdapter2MSBManager.class);
+
+ @Override
+ public JSONObject registerJujuAdapter(Map<String, String> paramsMap, JSONObject adapterInfo) {
+ JSONObject resultObj = new JSONObject();
+ //verify url,reserve
+
+ RestfulResponse rsp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap,adapterInfo.toString());
+ if(null == rsp) {
+ LOG.error("function=registerJujuAdapter, RestfulResponse is null");
+ resultObj.put(Constant.REASON, "RestfulResponse is null.");
+ resultObj.put(Constant.RETURN_CODE, Constant.ERROR_STATUS_CODE);
+ return resultObj;
+ }
+ String resultCreate = rsp.getResponseContent();
+
+ if(rsp.getStatus() == Constant.HTTP_CREATED) {
+ LOG.warn("function=registerJujuAdapter, msg= status={}, result={}.", rsp.getStatus(), resultCreate);
+ resultObj = JSONObject.fromObject(resultCreate);
+ resultObj.put(Constant.RETURN_CODE, Constant.HTTP_CREATED);
+ return resultObj;
+ } else if(rsp.getStatus() == Constant.INVALID_PARAMETERS){
+ LOG.error("function=registerJujuAdapter, msg=MSB return fail,invalid parameters,status={}, result={}.", rsp.getStatus(),
+ resultCreate);
+ resultObj.put(Constant.REASON, "MSB return fail,invalid parameters.");
+ } else if(rsp.getStatus() == Constant.HTTP_INNERERROR){
+ LOG.error("function=registerJujuAdapter, msg=MSB return fail,internal system error,status={}, result={}.", rsp.getStatus(),
+ resultCreate);
+ resultObj.put(Constant.REASON, "MSB return fail,internal system error.");
+ }
+ resultObj.put(Constant.RETURN_CODE, Constant.ERROR_STATUS_CODE);
+ return resultObj;
+ }
+
+ @Override
+ public JSONObject unregisterJujuAdapter(Map<String, String> paramsMap) {
+ JSONObject resultObj = new JSONObject();
+ //verify url,reserve
+
+ RestfulResponse rsp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap,"");
+ if(null == rsp) {
+ LOG.error("function=unregisterJujuAdapter, RestfulResponse is null");
+ resultObj.put(Constant.REASON, "RestfulResponse is null.");
+ resultObj.put(Constant.RETURN_CODE, Constant.ERROR_STATUS_CODE);
+ return resultObj;
+ }
+ String resultCreate = rsp.getResponseContent();
+
+ if(rsp.getStatus() == Constant.UNREG_SUCCESS) {
+ LOG.warn("function=unregisterJujuAdapter, msg= status={}, result={}.", rsp.getStatus(), resultCreate);
+ resultObj = JSONObject.fromObject(resultCreate);
+ resultObj.put(Constant.RETURN_CODE, Constant.UNREG_SUCCESS);
+ return resultObj;
+ } else if(rsp.getStatus() == Constant.HTTP_NOTFOUND){
+ LOG.error("function=unregisterJujuAdapter, msg=MSB return fail,can't find the service instance.status={}, result={}.", rsp.getStatus(),
+ resultCreate);
+ resultObj.put(Constant.REASON, "MSB return fail,can't find the service instance.");
+ } else if(rsp.getStatus() == Constant.INVALID_PARAMETERS){
+ LOG.error("function=unregisterJujuAdapter, msg=MSB return fail,invalid parameters,status={}, result={}.", rsp.getStatus(),
+ resultCreate);
+ resultObj.put(Constant.REASON, "MSB return fail,invalid parameters.");
+ } else if(rsp.getStatus() == Constant.HTTP_INNERERROR){
+ LOG.error("function=unregisterJujuAdapter, msg=MSB return fail,internal system error,status={}, result={}.", rsp.getStatus(),
+ resultCreate);
+ resultObj.put(Constant.REASON, "MSB return fail,internal system error.");
+ }
+ resultObj.put(Constant.RETURN_CODE, Constant.ERROR_STATUS_CODE);
+ return resultObj;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java
new file mode 100644
index 0000000..efd72d6
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManager.java
@@ -0,0 +1,449 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.impl;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils.ExeRes;
+import org.openo.nfvo.jujuvnfmadapter.common.FileUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.JujuConfigUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.YamlUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IJujuClientManager;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.openo.nfvo.jujuvnfmadapter.service.juju.JujuHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSON;
+import net.sf.json.JSONObject;
+
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 7, 2016
+ */
+public class JujuClientManager implements IJujuClientManager {
+ private static final Logger LOG = LoggerFactory.getLogger(JujuClientManager.class);
+
+ public static final String ADDRESOURCE="addResource";
+ public static final String REMOVERESOURCE = "removeResource";
+
+ /**
+ * <br/>
+ *
+ * @param charmPath
+ * @param appName
+ * @return
+ * @since NFVO 0.5
+ */
+ @Override
+ public JSONObject deploy(String charmPath, String appName) {
+ JSONObject result = new JSONObject();
+ if(charmPath == null || appName == null){
+ String msg = "the 'charmPath' or 'appName' can not be null";
+ result.put(EntityUtils.RESULT_CODE_KEY, -1);
+ result.put(EntityUtils.MSG_KEY, msg);
+ LOG.error(msg);
+ return result;
+ }
+ String modelName = JujuHelper.getModelName(appName);
+ //add-model
+ this.addModel(modelName);//use appName as modelName
+ //switch model
+ this.switchModel(modelName);
+ //deploy service
+ List<String> commands = new ArrayList<>();
+ commands.add("juju");
+ commands.add("deploy");
+ if(StringUtils.isNotBlank(charmPath)){
+ String fullPath = charmPath+appName;
+ commands.add(fullPath);
+ }else{
+ commands.add(appName);
+ }
+ commands.add("-m");
+ commands.add(modelName);
+ ExeRes exeRes = EntityUtils.execute(charmPath,commands);
+ if(exeRes.getCode() == ExeRes.SUCCESS){
+ LOG.info("deploy success. command:"+EntityUtils.formatCommand(commands));
+ result.put(EntityUtils.RESULT_CODE_KEY, 0);
+ result.put(EntityUtils.DATA_KEY, exeRes.getBody());
+ }else{
+ LOG.error("deploy failed. command:"+EntityUtils.formatCommand(commands)+"\n"+exeRes);
+ result.put(EntityUtils.RESULT_CODE_KEY, -1);
+ result.put(EntityUtils.MSG_KEY, "deploy failed:"+exeRes.getBody());
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * <br/>
+ *
+ * @param modelName
+ * @return
+ * @since NFVO 0.5
+ */
+ private JSONObject addModel(String modelName) {
+ JSONObject result = new JSONObject();
+ List<String> commands = new ArrayList<>();
+ commands.add("juju");
+ commands.add("add-model");
+ commands.add(modelName);
+ getExtraParam(commands);
+ ExeRes exeRes = EntityUtils.execute(null,commands);
+ if(exeRes.getCode() == ExeRes.SUCCESS){
+ LOG.info("addModel success. command:"+EntityUtils.formatCommand(commands));
+ result.put(EntityUtils.RESULT_CODE_KEY, 0);
+ result.put(EntityUtils.DATA_KEY, exeRes.getBody());
+ }else{
+ LOG.error("addModel failed. command:"+EntityUtils.formatCommand(commands)+"\n"+exeRes);
+ result.put(EntityUtils.RESULT_CODE_KEY, -1);
+ result.put(EntityUtils.MSG_KEY, "addModel failed:"+exeRes.getBody());
+ }
+
+ return result;
+ }
+
+ /**
+ * getExtraParam
+ * add model
+ juju add-model <model-name> --config image-metadata-url=http://192.168.20.106/images --config network=demo-net --config use-floating-ip=True --config use-default-secgroup=True
+ * @return
+ */
+ private void getExtraParam(List<String> commands){
+ try {
+ String configInfo = readJujuConfigInfo();
+ if(configInfo != null){
+ JSONObject json = JSONObject.fromObject(configInfo);
+ commands.add("--config");
+ commands.add("image-metadata-url="+json.getString("image-metadata-url"));
+ commands.add("--config");
+ commands.add("network="+json.getString("network"));
+ commands.add("--config");
+ commands.add("use-floating-ip="+json.getString("use-floating-ip"));
+ commands.add("--config");
+ commands.add("use-default-secgroup="+json.getString("use-default-secgroup"));
+ }
+ } catch (Exception e) {
+ LOG.error("read juju command config error:",e);
+ }
+ }
+
+ /**
+ * Get csar package information.<br>
+ *
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public static String readJujuConfigInfo() {
+ InputStream ins = null;
+
+ BufferedInputStream bins = null;
+ String fileContent = null;
+ String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator")
+ + "etc" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator")
+ + "juju_conf.json";
+ try {
+ ins = new FileInputStream(fileName);
+ bins = new BufferedInputStream(ins);
+
+ byte[] contentByte = new byte[ins.available()];
+ int num = bins.read(contentByte);
+
+ if (num > 0) {
+ fileContent = new String(contentByte);
+ }
+ } catch (Exception e) {
+ LOG.error(fileName + "is not found!", e);
+ } finally {
+ try {
+ if (ins != null) {
+ ins.close();
+ }
+ if (bins != null) {
+ bins.close();
+ }
+ } catch (IOException e) {
+ }
+ }
+ return fileContent;
+ }
+ private JSONObject changeDir(String charmPath) {
+ JSONObject result = new JSONObject();
+ List<String> commands = new ArrayList<>();
+ commands.add("cd");
+ commands.add(charmPath);
+ ExeRes exeRes = EntityUtils.execute(null,commands);
+ if(exeRes.getCode() == ExeRes.SUCCESS){
+ LOG.info("changeDir success. command:"+EntityUtils.formatCommand(commands));
+ result.put(EntityUtils.RESULT_CODE_KEY, 0);
+ result.put(EntityUtils.DATA_KEY, exeRes.getBody());
+ }else{
+ LOG.error("changeDir failed. command:"+EntityUtils.formatCommand(commands)+"\n"+exeRes);
+ result.put(EntityUtils.RESULT_CODE_KEY, -1);
+ result.put(EntityUtils.MSG_KEY, "addModel failed:"+exeRes.getBody());
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * <br/>
+ *
+ * @param modelName
+ * @return
+ * @since NFVO 0.5
+ */
+ private JSONObject switchModel(String modelName) {
+ JSONObject result = new JSONObject();
+ List<String> commands = new ArrayList<>();
+ commands.add("juju");
+ commands.add("switch");
+ commands.add(modelName);
+ ExeRes exeRes = EntityUtils.execute(null,commands);
+ if(exeRes.getCode() == ExeRes.SUCCESS){
+ LOG.info("switchModel success. command:"+EntityUtils.formatCommand(commands));
+ result.put(EntityUtils.RESULT_CODE_KEY, 0);
+ result.put(EntityUtils.DATA_KEY, exeRes.getBody());
+ }else{
+ LOG.error("switchModel failed. command:"+EntityUtils.formatCommand(commands)+"\n"+exeRes);
+ result.put(EntityUtils.RESULT_CODE_KEY, -1);
+ result.put(EntityUtils.MSG_KEY, "addModel failed:"+exeRes.getBody());
+ }
+
+ return result;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param appName
+ * @return
+ * @since NFVO 0.5
+ */
+ @Override
+ public JSONObject destroy(String appName) {
+ String modelName = JujuHelper.getModelName(appName);
+ JSONObject result = new JSONObject();
+ List<String> commands = new ArrayList<>();
+ commands.add("juju");
+ commands.add("destroy-model");
+ commands.add("-y");
+ commands.add(modelName);
+
+ ExeRes exeRes = EntityUtils.execute(null,commands);
+ if(exeRes.getCode() == ExeRes.SUCCESS){
+ LOG.info("remove success. command:"+EntityUtils.formatCommand(commands));
+ result.put(EntityUtils.RESULT_CODE_KEY, 0);
+ result.put(EntityUtils.DATA_KEY, exeRes.getBody());
+ }else{
+ LOG.error("remove failed. command:"+EntityUtils.formatCommand(commands)+"\n"+exeRes);
+ result.put(EntityUtils.RESULT_CODE_KEY, -1);
+ result.put(EntityUtils.MSG_KEY, "remove failed:"+exeRes.getBody());
+ }
+
+ return result;
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @param appName
+ * @return
+ * @since NFVO 0.5
+ */
+ @Override
+ public JSONObject getStatus(String appName) {
+ String modelName = JujuHelper.getModelName(appName);
+ JSONObject result = new JSONObject();
+ List<String> commands = new ArrayList<>();
+ commands.add("juju");
+ commands.add("status");
+ if(StringUtils.isNotBlank(modelName)){
+ commands.add("-m");
+ commands.add(modelName);
+ }
+ commands.add("--format=json");
+
+ ExeRes exeRes = EntityUtils.execute(null,commands);
+ if(exeRes.getCode() == ExeRes.SUCCESS){
+ LOG.info("getStatus success. command:"+EntityUtils.formatCommand(commands));
+ result.put(EntityUtils.RESULT_CODE_KEY, 0);
+ JSONObject dataObj = buildDataObj(exeRes);
+ result.put(EntityUtils.DATA_KEY, dataObj);
+ }else{
+ LOG.error("getStatus failed. command:"+EntityUtils.formatCommand(commands)+"\n"+exeRes);
+ result.put(EntityUtils.RESULT_CODE_KEY, -1);
+ result.put(EntityUtils.MSG_KEY, "getStatus failed:"+exeRes.getBody());
+ }
+
+ return result;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param exeRes
+ * @return
+ * @since NFVO 0.5
+ */
+ private JSONObject buildDataObj(ExeRes exeRes) {
+ JSONObject dataObj = null;
+ if(StringUtils.isNotBlank(exeRes.getBody())){
+ dataObj = JSONObject.fromObject(exeRes.getBody());
+ //according to appName to select
+ }
+ return dataObj;
+ }
+
+
+ /**
+ * call the juju vnfm to grant resource(disk,mem,cpu)
+ * <br/>
+ * (fields:cpu,mem,disk,action(addResource/removeResource))
+ * @param vnfId
+ * @param appName
+ * @param action
+ * @since NFVO 0.5
+ * @return
+ */
+ @Override
+ public boolean grantResource(String charmPath, String appName,String action , String vnfId){
+ //1.parse yaml file
+ JSONObject params;
+ try {
+ params = this.parseYaml(charmPath, appName, action);
+ } catch(Exception e) {
+ LOG.error("ParseYaml error,please check it.",e);
+ return false;
+ }
+ if(params == null){
+ LOG.error("ParseYaml fail,please check it.");
+ return false;
+ }
+
+ //2. call grant service
+ String url = JujuConfigUtil.getValue("grant_jujuvnfm_url");
+ Map<String, String> paramsMap = new HashMap<>(6);
+ paramsMap.put("url", url);
+ paramsMap.put(Constant.METHOD_TYPE, Constant.PUT);
+ paramsMap.put("path", String.format(UrlConstant.REST_JUJU_VNFM_GRANT_URL,vnfId));
+ paramsMap.put(Constant.AUTH_MODE, Constant.AuthenticationMode.ANONYMOUS);
+ RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(paramsMap, params.toString(), null);
+ if(rsp == null || rsp.getStatus() != Constant.HTTP_OK) {
+ LOG.error("function=grantResource, msg=send grantResource msg to juju-vnfm get wrong results");
+ return false;
+ }
+ //3.process result
+ String response = rsp.getResponseContent();
+ LOG.info("grant resource result:"+response);
+ return true;
+ }
+
+ /**
+ *
+ * <br/>
+ * "constraints":"arch=amd64 cpu-cores=1 cpu-power=100 mem=1740 root-disk=8192"
+ * @param charmPath
+ * @param appName
+ * @param action
+ * @return
+ * @since NFVO 0.5
+ */
+ public JSONObject parseYaml(String charmPath, String appName,String action){
+ JSONObject compute = new JSONObject();
+ compute.put("action", action);
+ if(StringUtils.isBlank(charmPath)){
+ LOG.error("the charmPath can't be null! [in unzipFileAndParseYaml]");
+ return null;
+ }
+ //set default values for non 'yaml' type
+ if(!appName.endsWith(".yaml")){
+ compute.put("cpu", 4);
+ compute.put("mem", 2);
+ compute.put("disk", 40);
+ return compute;
+ }
+ String yaml = FileUtils.getFriendlyPath(charmPath)+appName;
+ File yamlFile = new File(yaml);
+ if(yamlFile.exists()){
+ JSON json = YamlUtil.yamlToJson(yamlFile.getAbsolutePath());
+ LOG.info(yaml+":\n"+json);
+ if(json.isArray()){
+ LOG.error("the yaml file has error format,please check it!"+yamlFile);
+ return null;
+ }
+ JSONObject jsonObj = (JSONObject)json;
+ JSONObject services = jsonObj.getJSONObject("services");
+ int cpu = 0;
+ int mem = 0;
+ int disk = 0;
+ for(Object key: services.keySet()){
+ JSONObject app = services.getJSONObject(key.toString());
+ if(app.containsKey("constraints")){
+ String constraints = app.getString("constraints");
+ String[] vals = constraints.split("\\s+");
+ LOG.info(key+"="+constraints);
+ for(String val : vals){
+ String[] kv = val.split("=");
+ if("cpu-cores".equals(kv[0]) && StringUtils.isNotBlank(kv[1])){
+ cpu+=Integer.valueOf(kv[1]);
+ }else if("mem".equals(kv[0]) && StringUtils.isNotBlank(kv[1])){
+ mem+=Integer.valueOf(kv[1]);
+ }else if("root-disk".equals(kv[0]) && StringUtils.isNotBlank(kv[1])){
+ disk+=Integer.valueOf(kv[1]);
+ }
+ }
+ }
+ }
+ compute.put("cpu", cpu);
+ compute.put("mem", mem);
+ compute.put("disk", disk);
+ }else{
+ LOG.error("the yaml file not exist!file="+yamlFile);
+ return null;
+ }
+ LOG.info("parse yaml result-->"+compute);
+ return compute;
+ }
+
+
+ public static void main(String[] args) {
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ jujuClientManager.parseYaml("E:/workspace/openo-common-utils/src/org/openo/common/yaml", "test.yaml", "addResource");
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2DriverManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2DriverManager.java
new file mode 100644
index 0000000..30f92e4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2DriverManager.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.adapter.inf;
+
+import java.util.Map;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Jan 24, 2017
+ */
+public interface IJujuAdapter2DriverManager {
+
+ /**
+ * Method to Register Driver.<br/>
+ *
+ * @param paramsMap
+ * @param driverInfo
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject registerDriver(Map<String, String> paramsMap, JSONObject driverInfo);
+
+ /**
+ * Method to Unregister Driver.<br/>
+ *
+ * @param paramsMap
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject unregisterDriver(Map<String, String> paramsMap);
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2MSBManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2MSBManager.java
new file mode 100644
index 0000000..03a9cf7
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuAdapter2MSBManager.java
@@ -0,0 +1,56 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.inf;
+
+import java.util.Map;
+
+
+import net.sf.json.JSONObject;
+
+/**
+ *
+ * iJuju adapter to msb manager class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public interface IJujuAdapter2MSBManager{
+
+ /**
+ *
+ * Register juju adapter.<br>
+ *
+ * @param paramsMap
+ * @param driverInfo
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject registerJujuAdapter(Map<String,String> paramsMap, JSONObject driverInfo);
+
+ /**
+ *
+ * Unregister juju adapter.<br>
+ *
+ * @param paramsMap
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject unregisterJujuAdapter(Map<String,String> paramsMap);
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuClientManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuClientManager.java
new file mode 100644
index 0000000..fab61a8
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IJujuClientManager.java
@@ -0,0 +1,84 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.inf;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 7, 2016
+ */
+public interface IJujuClientManager {
+
+ /**
+ * * deploy juju charm from local filesystem. The charm will get deployed on a trusty instance
+ * with at least 2 GB RAM
+ * juju deploy $HOME/charms/example --series trusty --constraints mem=2G --config
+ * /path/to/custom/charm-config.yaml
+ * <br/>
+ *
+ * @param charmPath
+ * @param mem (at least 2 GB RAM) unit/GB
+ * @param appName
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject deploy(String charmPath, String appName);
+
+ /**
+ * * remove a charm completely
+ * juju remove-application example
+ * juju destroy-model model-name
+ * <br/>
+ *
+ * @param appName
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject destroy(String appName);
+
+ /**
+ * juju status --format=json
+ * juju status -m model-name --format=json
+ * get the status of a single charm
+ * juju status example --format=json
+ * Here is an example output from juju status --format=json
+ * http://paste.ubuntu.com/23113992/
+ * <br/>
+ *
+ * @param modelName
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject getStatus(String modelName);
+ /**
+ *
+ * <br/>
+ *
+ * @param charmPath
+ * @param appName
+ * @param action
+ * @param vnfId
+ * @return
+ * @since NFVO 0.5
+ */
+ public boolean grantResource(String charmPath, String appName,String action , String vnfId);
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IResourceManager.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IResourceManager.java
new file mode 100644
index 0000000..7c05fd3
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/inf/IResourceManager.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.jujuvnfmadapter.service.adapter.inf;
+
+import java.util.Map;
+import net.sf.json.JSONObject;
+
+/**
+ *
+ * iResource manager interface.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public interface IResourceManager {
+
+ /**
+ *
+ * Get juju vnfm information.<br>
+ *
+ * @param paramsMap
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject getJujuVnfmInfo(Map<String,String> paramsMap);
+
+ /**
+ *
+ * Get vfnfd information.<br>
+ *
+ * @param paramsMap
+ * @return
+ * @since NFVO 0.5
+ */
+ JSONObject getVnfdInfo(String csarId);
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapter2DriverMgrService.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapter2DriverMgrService.java
new file mode 100644
index 0000000..a297110
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapter2DriverMgrService.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.api.internalsvc.impl;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executors;
+
+import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.JujuAdapter2DriverManager;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IJujuAdapter2DriverManager;
+import org.openo.nfvo.jujuvnfmadapter.service.api.internalsvc.inf.IJujuAdapter2DriverMgrService;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Jan 24, 2017
+ */
+public class JujuAdapter2DriverMgrService implements IJujuAdapter2DriverMgrService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JujuAdapter2DriverMgrService.class);
+
+ public static final String VIMADAPTER2DRIVERMGR = "vimadapter2drivermgr.json";
+
+ @Override
+ public void register() {
+ // set URL and mothedtype
+ Map<String, String> paramsMap = new HashMap<>();
+ paramsMap.put("url", UrlConstant.REST_DRIVERMGR_REGISTER);
+ paramsMap.put("methodType", Constant.POST);
+
+ // get vim adapter info and raise registration
+ try {
+ String adapterInfo = readVimAdapterInfoFromJson();
+ if(!"".equals(adapterInfo)) {
+ JSONObject adapterObject = JSONObject.fromObject(adapterInfo);
+ RegisterVnfm2DriverMgrThread vnfmAdapterThread =
+ new RegisterVnfm2DriverMgrThread(paramsMap, adapterObject);
+ Executors.newSingleThreadExecutor().submit(vnfmAdapterThread);
+ } else {
+ LOG.error("vnfmadapter2drivermgr info is null,please check!");
+ }
+
+ } catch(IOException e) {
+ LOG.error("Failed to read vnfmadapter2drivermgr info! " + e.getMessage(), e);
+ }
+
+ }
+
+ /**
+ * Retrieve VIM driver information.
+ *
+ * @return
+ * @throws IOException
+ */
+ public static String readVimAdapterInfoFromJson() throws IOException {
+ InputStream ins = null;
+ BufferedInputStream bins = null;
+ String fileContent = "";
+
+ String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator")
+ + "etc" + System.getProperty("file.separator") + "adapterInfo" + System.getProperty("file.separator")
+ + VIMADAPTER2DRIVERMGR;
+
+ try {
+ ins = new FileInputStream(fileName);
+ bins = new BufferedInputStream(ins);
+
+ byte[] contentByte = new byte[ins.available()];
+ int num = bins.read(contentByte);
+
+ if(num > 0) {
+ fileContent = new String(contentByte);
+ }
+ } catch(FileNotFoundException e) {
+ LOG.error(fileName + "is not found!", e);
+ } finally {
+ if(ins != null) {
+ ins.close();
+ }
+ if(bins != null) {
+ bins.close();
+ }
+ }
+
+ return fileContent;
+ }
+
+ private static class RegisterVnfm2DriverMgrThread implements Runnable {
+
+ // Thread lock Object
+ private final Object lockObject = new Object();
+
+ private IJujuAdapter2DriverManager adapter2DriverMgr = new JujuAdapter2DriverManager();
+
+ // url and mothedtype
+ private Map<String, String> paramsMap;
+
+ // driver body
+ private JSONObject adapterInfo;
+
+ public RegisterVnfm2DriverMgrThread(Map<String, String> paramsMap, JSONObject adapterInfo) {
+ this.paramsMap = paramsMap;
+ this.adapterInfo = adapterInfo;
+ }
+
+ @Override
+ public void run() {
+ LOG.info("start register vnfmadapter to Driver Manager", RegisterVnfm2DriverMgrThread.class);
+
+ if(paramsMap == null || adapterInfo == null) {
+ LOG.error("parameter is null,please check!", RegisterVnfm2DriverMgrThread.class);
+ return;
+ }
+
+ // catch Runtime Exception
+ try {
+ sendRequest(paramsMap, adapterInfo);
+ } catch(RuntimeException e) {
+ LOG.error(e.getMessage(), e);
+ }
+
+ }
+
+ private void sendRequest(Map<String, String> paramsMap, JSONObject driverInfo) {
+ JSONObject resultObj = adapter2DriverMgr.registerDriver(paramsMap, driverInfo);
+
+ if(Integer.valueOf(resultObj.get("retCode").toString()) == Constant.HTTP_CREATED) {
+ LOG.info("Vnfmadapter has now Successfully Registered to the Driver Manager!");
+ } else {
+ LOG.error("Vnfmadapter failed to Register to the Driver Manager! Reason:"
+ + resultObj.get("reason").toString() + " retCode:" + resultObj.get("retCode").toString());
+
+ // if registration fails,wait one minute and try again
+ try {
+ synchronized(lockObject) {
+ lockObject.wait(Constant.REPEAT_REG_TIME);
+ }
+ } catch(InterruptedException e) {
+ LOG.error(e.getMessage(), e);
+ }
+
+ sendRequest(this.paramsMap, this.adapterInfo);
+ }
+
+ }
+
+ }
+
+ @Override
+ public void unregister() {
+ // unregister
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrService.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrService.java
new file mode 100644
index 0000000..58b9c23
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrService.java
@@ -0,0 +1,196 @@
+/*
+ * 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.jujuvnfmadapter.service.api.internalsvc.impl;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executors;
+
+import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.JujuAdapter2MSBManager;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IJujuAdapter2MSBManager;
+import org.openo.nfvo.jujuvnfmadapter.service.api.internalsvc.inf.IJujuAdapterMgrService;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ * Juju adapter manager service class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class JujuAdapterMgrService implements IJujuAdapterMgrService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JujuAdapterMgrService.class);
+
+ @Override
+ public void register() {
+ // set BUS URL and mothedtype
+ Map<String, String> paramsMap = new HashMap<>();
+ paramsMap.put("url", UrlConstant.REST_MSB_REGISTER);
+ paramsMap.put("methodType", Constant.POST);
+
+ // get juju adapter info and raise registration
+ try {
+ String adapterInfo = readJujuAdapterInfoFromJson();
+ if(!"".equals(adapterInfo)) {
+ JSONObject adapterObject = JSONObject.fromObject(adapterInfo);
+ RegisterJujuAdapterThread jujuAdapterThread = new RegisterJujuAdapterThread(paramsMap, adapterObject);
+ Executors.newSingleThreadExecutor().submit(jujuAdapterThread);
+ } else {
+ LOG.error("JujuVnfmAdapter info is null,please check!", JujuAdapterMgrService.class);
+ }
+
+ } catch(IOException e) {
+ LOG.error("Failed to read JujuVnfmAdapter info!" + e, JujuAdapterMgrService.class);
+ }
+
+ }
+
+ /**
+ * Read juju adapter information from Json.<br>
+ *
+ * @return
+ * @throws IOException
+ * @since NFVO 0.5
+ */
+ public static String readJujuAdapterInfoFromJson() throws IOException {
+ InputStream ins = null;
+ BufferedInputStream bins = null;
+ String fileContent = "";
+
+ String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot()
+ + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR)
+ + "adapterInfo" + System.getProperty(Constant.FILE_SEPARATOR) + Constant.JUJUADAPTERINFO;
+
+ try {
+ ins = new FileInputStream(fileName);
+ bins = new BufferedInputStream(ins);
+
+ byte[] contentByte = new byte[ins.available()];
+ int num = bins.read(contentByte);
+
+ if(num > 0) {
+ fileContent = new String(contentByte);
+ }
+ } catch(FileNotFoundException e) {
+ LOG.error(fileName + "is not found!", e, JujuAdapterMgrService.class);
+ } finally {
+ if(null != ins) {
+ ins.close();
+ }
+
+ if(null != bins) {
+ bins.close();
+ }
+ }
+
+ return fileContent;
+ }
+
+ private static class RegisterJujuAdapterThread implements Runnable {
+
+ // Thread lock Object
+ private final Object lockObject = new Object();
+
+ private IJujuAdapter2MSBManager adapter2MSBMgr = new JujuAdapter2MSBManager();
+
+ // url and mothedtype
+ private Map<String, String> paramsMap;
+
+ // driver body
+ private JSONObject adapterInfo;
+
+ public RegisterJujuAdapterThread(Map<String, String> paramsMap, JSONObject adapterInfo) {
+ this.paramsMap = paramsMap;
+ this.adapterInfo = adapterInfo;
+ }
+
+ @Override
+ public void run() {
+ LOG.info("start register jujuvnfmadapter", RegisterJujuAdapterThread.class);
+
+ if(paramsMap == null || adapterInfo == null) {
+ LOG.error("parameter is null,please check!", RegisterJujuAdapterThread.class);
+ return;
+ }
+
+ // catch Runtime Exception
+ try {
+ sendRequest(paramsMap, adapterInfo);
+ } catch(RuntimeException e) {
+ LOG.error(e.getMessage(), e);
+ }
+
+ }
+
+ private void sendRequest(Map<String, String> paramsMap, JSONObject driverInfo) {
+ JSONObject resultObj = adapter2MSBMgr.registerJujuAdapter(paramsMap, driverInfo);
+
+ if(Integer.valueOf(resultObj.get("retCode").toString()) == Constant.HTTP_CREATED) {
+ LOG.info("JujuVnfmAdapter has now Successfully Registered to the Microservice BUS!",
+ JujuAdapterMgrService.class);
+ } else {
+ LOG.error("JujuVnfmAdapter failed to Register to the Microservice BUS! Reason:"
+ + resultObj.get("reason").toString() + " retCode:" + resultObj.get("retCode").toString());
+
+ // if registration fails,wait one minute and try again
+ try {
+ synchronized(lockObject) {
+ lockObject.wait(Constant.REPEAT_REG_TIME);
+ }
+ } catch(InterruptedException e) {
+ LOG.error("sendRequest error", e);
+ }
+
+ sendRequest(this.paramsMap, this.adapterInfo);
+ }
+
+ }
+
+ }
+
+ @Override
+ public void unregister() {
+ // Not implemented
+
+ }
+
+ /**
+ * Main method.<br>
+ *
+ * @param args
+ * @since NFVO 0.5
+ */
+ public static void main(String[] args) {
+ LOG.info(SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty(Constant.FILE_SEPARATOR)
+ + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + "adapterInfo"
+ + System.getProperty(Constant.FILE_SEPARATOR) + Constant.JUJUADAPTERINFO);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapter2DriverMgrService.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapter2DriverMgrService.java
new file mode 100644
index 0000000..ab8b839
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapter2DriverMgrService.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.api.internalsvc.inf;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Jan 24, 2017
+ */
+public interface IJujuAdapter2DriverMgrService {
+
+ /**
+ * VimAdapter register interface.<br>
+ *
+ * @since NFVO 0.5
+ */
+ void register();
+
+ /**
+ * VimAdapter unregister interface.<br>
+ *
+ * @since NFVO 0.5
+ */
+ void unregister();
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapterMgrService.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapterMgrService.java
new file mode 100644
index 0000000..c3c0f12
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/inf/IJujuAdapterMgrService.java
@@ -0,0 +1,45 @@
+/*
+ * 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.jujuvnfmadapter.service.api.internalsvc.inf;
+
+/**
+ *
+ * Ijuju adapter manager service interface.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public interface IJujuAdapterMgrService {
+
+ /**
+ *
+ * JujuVnfmAdapter register interface.<br>
+ *
+ * @since NFVO 0.5
+ */
+ void register();
+
+ /**
+ *
+ * JujuVnfmAdapter unregister interface.<br>
+ *
+ * @since NFVO 0.5
+ */
+ void unregister();
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/Constant.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/Constant.java
new file mode 100644
index 0000000..0ae5c7f
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/Constant.java
@@ -0,0 +1,219 @@
+/*
+ * 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.jujuvnfmadapter.service.constant;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Constant class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class Constant {
+
+ public static final String VNFM_APP = "VnfmDriver";
+
+ public static final String VNFM_DB = "vnfmdb";
+
+ public static final String VNFM_ID = "vnfmId";
+
+ public static final String POST = "post";
+
+ public static final String PUT = "put";
+
+ public static final String DELETE = "delete";
+
+ public static final String GET = "get";
+
+ public static final String HEAD = "head";
+
+ public static final String ASYNCPOST = "asyncPost";
+
+ public static final String ASYNCGET = "asyncGet";
+
+ public static final String ASYNCPUT = "asyncPut";
+
+ public static final String ASYNCDELETE = "asyncDelete";
+
+ public static final String RESPONSE_CONTENT = "responseContent";
+
+ public static final String STATUS_CODE = "statusCode";
+
+ public static final String RETURN_CODE = "retCode";
+
+ public static final String REASON = "reason";
+
+ public static final int ERROR_STATUS_CODE = -1;
+
+ public static final String ENCODEING = "utf-8";
+
+ public static final String COOKIE = "Cookie";
+
+ public static final String ACCESSSESSION = "bspsession=";
+
+ public static final String CONTENT_TYPE = "Content-Type";
+
+ public static final String METHOD_TYPE = "methodType";
+
+ public static final String AUTH_MODE = "authMode";
+
+ public static final String APPLICATION = "application/json";
+
+ public static final String APP_NAME = "appName";
+
+ public static final String HEADER_SUBJECT_TOKEN = "X-Subject-Token";
+
+ public static final String HEADER_AUTH_TOKEN = "X-Auth-Token";
+
+ public static final String CSM = "csm";
+
+ public static final int ERROR_CODE = -1;
+
+ public static final int HTTP_OK = 200;
+
+ public static final int HTTP_CREATED = 201;
+
+ public static final int HTTP_ACCEPTED = 202;
+
+ public static final int UNREG_SUCCESS = 204;
+
+ public static final int HTTP_BAD_REQUEST = 400;
+
+ public static final int HTTP_UNAUTHORIZED = 401;
+
+ public static final int HTTP_NOTFOUND = 404;
+
+ public static final int HTTP_CONFLICT = 409;
+
+ public static final int INVALID_PARAMETERS = 415;
+
+ public static final int HTTP_INNERERROR = 500;
+
+ public static final int REPEAT_REG_TIME = 60 * 1000;
+
+ public static final String JUJUADAPTERINFO = "jujuadapterinfo.json";
+
+ public static final String FILE_SEPARATOR = "file.separator";
+
+ public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+ public static final List<String> AUTHLIST =
+ Collections.unmodifiableList(Arrays.asList(AuthenticationMode.ANONYMOUS, AuthenticationMode.CERTIFICATE));
+
+ public static final int INTERNAL_EXCEPTION = 600;
+
+ public static final int TOKEN_HEAD_NULL = 601;
+
+ public static final int TOKEN_USER_NULL = 602;
+
+ public static final int SERVICE_URL_ERROR = 603;
+
+ public static final int ACCESS_OBJ_NULL = 604;
+
+ public static final int CONNECT_NOT_FOUND = 605;
+
+ public static final int VCENTER_PARA_ERROR = 606;
+
+ public static final int TYPE_PARA_ERROR = 607;
+
+ public static final int CONNECT_FAIL = 608;
+
+ public static final int DIS_CONNECT_FAIL = 609;
+
+ public static final int HANDSHAKE_FAIL = 610;
+
+ public static final int MIN_PWD_LENGTH = 6;
+
+ public static final int MAX_PWD_LENGTH = 160;
+
+ public static final int MIN_URL_LENGTH = 7;
+
+ public static final int MAX_VNFM_NAME_LENGTH = 64;
+
+ public static final int MIN_VNFM_NAME_LENGTH = 1;
+
+ public static final int MAX_URL_LENGTH = 256;
+
+ public static final int MAX_SAMPLE_NUM = 1;
+
+ public static final int MAX_VERSION_LENGTH = 160;
+
+ public static final int MIN_VERSION_LENGTH = 1;
+
+ public static final String HANDSHAKE = "handShake";
+
+ public static final String INACTIVE = "inactive";
+
+ public static final String ACTIVE = "active";
+
+ public static final String RESOURCE_PATH = "";
+
+ public static final int REST_SUCCESS = 1;
+
+ public static final int REST_PART_SUCCESS = 0;
+
+ public static final int DEFAULT_COLLECTION_SIZE = 10;
+
+ public static final int REST_FAIL = -1;
+
+ public static final String ROARAND = "?roarand=%s";
+
+ public static final long PROCESS_WAIT_MILLIS = 30000;
+
+ public static final String CSARINFO="csarinfo.json";
+
+ public static final String DOWNLOADCSAR_SUCCESS = "Success";
+
+ public static final String DOWNLOADCSAR_FAIL = "FAIL";
+
+ public static final int UNZIP_SUCCESS = 0;
+
+ public static final int UNZIP_FAIL = -1;
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ */
+ private Constant() {
+ // Private Constructor
+ }
+
+ /**
+ * Authentication mode.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+ public static class AuthenticationMode {
+
+ public static final String ANONYMOUS = "Anonymous";
+
+ public static final String CERTIFICATE = "Certificate";
+
+ private AuthenticationMode() {
+
+ }
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstants.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstants.java
new file mode 100644
index 0000000..fc734ce
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstants.java
@@ -0,0 +1,144 @@
+/*
+ * 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.jujuvnfmadapter.service.constant;
+
+/**
+ *
+ * Parameter constants class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class ParamConstants {
+
+ public static final String GET_TOKENS_V1 = "{\"grantType\": \"password\", \"userName\": \"%s\",\"value\": \"%s\"}";
+
+ public static final String GET_TOKENS_V2 =
+ "{\"auth\":{\"identity\": {\"methods\": [\"password\"],\"password\": {\"user\": {\"name\": \"%s\",\"password\": \"%s\"}}}}}";
+
+ public static final String GET_IAM_TOKENS =
+ "{\"auth\": {\"identity\": {\"methods\": [\"password\"],\"password\": {\"user\": {\"name\": "
+ + "\"%s\",\"password\": \"%s\",\"domain\": {\"name\": \"%s\"}}}},\"scope\": {\"domain\": {\"name\": \"%s\"}}}}";
+
+ public static final String GET_TOKEN_SUC_RESP =
+ "{\"token\": {\"methods\": [\"password\"],\"expires_at\": \"\",\"user\": {\"id\": \"%s\","
+ + "\"name\": \"%s\"},\"roa_rand\": \"%s\"}}";
+
+ public static final String GET_TOKEN_FAIL_RESP = "{\"Information\": \"%s\"}";
+
+ public static final String REST_3RD_CONNECTION = "/rest/plat/smapp/v1/oauth/token";
+
+ public static final String REST_3RD_DISCONNECT = "/rest/plat/smapp/v1/sessions?roarand=%s";
+
+ public static final String REST_3RD_HANDSHAKE = "/rest/plat/ssm/v1/sessions/verify";
+
+ public static final String IAM_AUTH = "/v3/auth/tokens";
+
+ public static final String CSM_AUTH_CONNECT = "/v2/auth/tokens";
+
+ public static final String CSM_AUTH_DISCONNECT = "/v2/auth/tokens/%s/%s";
+
+ public static final String CSM_AUTH_HANDSHAKE = "/v2/nfvo/shakehand?roattr=status";
+
+ public static final String VNFMMED = "/rest/vnfmmed/";
+
+ public static final String CONNECTMGR_CONNECT = "/connectmgr/v1/connect";
+
+ public static final String CONNECTMGR_DISCONNECT = "/connectmgr/v1/disconnect";
+
+ public static final String CONNECTMGR_HANDSHAKE = "/connectmgr/v1/handshake";
+
+ public static final String CREATE_VNF_PERF = "/staticsmgr/v1/vnfperformance";
+
+ public static final String VNFMGR_INSTANCE = "/vnfmgr/v1/instances";
+
+ public static final String VNF_SCALE = "/vnfmgr/v1/instances/%s/scale";
+
+ public static final String VNFD_FLAVOR = "/vnfdmgr/v1/flavor";
+
+ public static final String VNFDGR_INSTALL = "/vnfdmgr/v1/vnfd/%s/install";
+
+ public static final String VNFDGR_DETAIL = "/vnfdmgr/v1/vnfd/%s";
+
+ public static final String VNFDGR_DETAILS = "/vnfdmgr/v1/vnfd";
+
+ public static final String VNFDGR_TOPOLOGY = "/vnfdmgr/v1/topology/%s";
+
+ public static final String UPDATE_RESOURCE = "/rest/v1/resmanage/resuse/updateres";
+
+ public static final String VNFDGR_INSTANCE = "/vnfmmed/v1/vnfdm/";
+
+ public static final String VNF_QUERY = "/resmgr/v1/vnfs";
+
+ public static final String VMS_QUERY = "/resmgr/v1/vms";
+
+ public static final String REST_EVENT_ADD = "/rest/v1/resmanage/vnfm/site";
+
+ public static final String REST_EVENT_DEL = "/rest/v1/resmanage/vnfm/site/%s";
+
+ public static final String VNFMGR_VNFKPI = "/staticsmgr/v1/vnfkpi";
+
+ public static final String RES_VNF = "/rest/v1/resmanage/vappvm";
+
+ public static final String NOTIFY_VNF_PERF = "/rest/v1/resmanage/vappvm";
+
+ public static final String PARAM_MODULE = "VnfmDriver";
+
+ public static final String GET_ALL_SITES = "/rest/v1/resmanage/sites";
+
+ public static final String GET_ALL_SOS = "/rest/sodriver/v1/sos";
+
+ public static final String OPERATION_LOG_PATH = "/rest/plat/audit/v1/logs";
+
+ public static final String SYSTEM_LOG_PATH = "/rest/plat/audit/v1/systemlogs";
+
+ public static final String SECURITY_LOG_PATH = "/rest/plat/audit/v1/seculogs";
+
+ public static final String SCALINGPOLICY_QUERY = "/policymgr/v1/scalingpolicy";
+
+ public static final String SCALINGPOLICY_OPERATE = "/policymgr/v1/scalingpolicy/%s/%s";
+
+ public static final String ACTIVE_POLICY = "/policymgr/v1/activepolicy";
+
+ public static final String DEACTIVE_POLICY = "/policymgr/v1/deactivepolicy";
+
+ public static final String GET_VNFM_VNF = "/rest/v1/resmanage/vapps?vnfmId=%s";
+
+ public static final String GET_RES_NET = "/rest/v1/resmanage/virtualnetworks?id=%s";
+
+ public static final String GET_JOB_STATUS = "/vnfmgr/v1/jobs/%s";
+
+ public static final String CREATE_POLICY = "/policymgr/v1/vnfs/%s/policies";
+
+ public static final String REST_FOR_VNFD_PLANS = "/v2/vapps/templates/%s/plans";
+
+ public static final String REST_GET_VNFDS = "/v2/vapps/templates";
+
+ public static final String REST_FOR_VNFD_BASIC = "/v2/vapps/templates?type=basic&vendor=%s&vnfdID=%s&version=%s";
+
+ public static final String REST_TOPOLOGY = "/v1/vapps/templates/%s?type=templatetopology";
+
+ public static final String VNF_INSTANCE = "/v2/vapps/instances";
+
+ public static final String VNF_INSTANCE_DEL = "/v2/vapps/instances/%s";
+
+ private ParamConstants() {
+ //Constructor
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstant.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstant.java
new file mode 100644
index 0000000..1074209
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstant.java
@@ -0,0 +1,54 @@
+/*
+ * 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.jujuvnfmadapter.service.constant;
+
+/**
+ * Url constant class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 10, 2016
+ */
+public class UrlConstant {
+
+ public static final String REST_DRIVERMGR_REGISTER = "/openoapi/drivermgr/v1/drivers";
+
+ public static final String REST_MSB_REGISTER = "/api/microservices/v1/services";
+
+ public static final String REST_ESRINFO_GET = "/openoapi/extsys/v1/vnfms/%s";
+
+ public static final String REST_VNFDINFO_GET =
+ "/openoapi/catalog/v1/csars/%s/files?relativePath=%s&relativePath=%s";
+
+ public static final String REST_MSB_UNREGISTER = "/openoapi/microservices/v1/services/%s/version/%s/nodes/%s/%s";
+
+ public static final String REST_JUJU_CLIENT_DEPLOY = "/openoapi/jujuvnfm/v1/vnfms/deploy";
+
+ public static final String REST_JUJU_CLIENT_DESTORY = "/openoapi/jujuvnfm/v1/vnfms/destroy";
+
+ public static final String REST_JUJU_CLIENT_GET = "/openoapi/jujuvnfm/v1/vnfms/status?modelName=%s";
+
+ public static final String RES_VNF = "/openoapi/nslcm/v1/ns/grantvnf";
+ public static final String REST_JUJU_VNFM_GRANT_URL = "/openoapi/jujuvnfm/v1/instances/%s/grant";
+
+ public static final String REST_CSARINFO_GET = "/openoapi/catalog/v1/csars/%s";
+
+ private UrlConstant() {
+ // Constructor
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriver.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriver.java
new file mode 100644
index 0000000..d4b4f50
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriver.java
@@ -0,0 +1,203 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import java.util.List;
+
+import net.sf.json.JSONObject;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ *
+ * Juju Driver Class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 10, 2016
+ */
+public class JujuDriver {
+
+ private String serviceName;
+
+ private String protocol;
+
+ private String version;
+
+ private String visualRange;
+
+ private String url;
+
+ private List nodes;
+
+ private String ip;
+
+ private String port;
+
+ private String ttl;
+
+ private String status;
+
+ public static final String NOTES = "notes";
+
+ public JujuDriver() {
+ // Default Constructor
+ }
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param jujuJsonObject
+ * @since NFVO 0.5
+ */
+ public JujuDriver(JSONObject jujuJsonObject) {
+ this.serviceName = jujuJsonObject.getString("serviceName");
+ this.protocol = jujuJsonObject.getString("protocol");
+ this.version = jujuJsonObject.getString("version");
+ this.visualRange = jujuJsonObject.getString("visualRange");
+ this.url = jujuJsonObject.getString("url");
+ this.nodes = jujuJsonObject.getJSONArray("nodes");
+ this.ip = jujuJsonObject.getJSONArray(NOTES).getString(0);
+ this.port = jujuJsonObject.getJSONArray(NOTES).getString(1);
+ this.ttl = jujuJsonObject.getJSONArray(NOTES).getString(2);
+ this.status = jujuJsonObject.getString("status");
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getVisualRange() {
+ return visualRange;
+ }
+
+ public void setVisualRange(String visualRange) {
+ this.visualRange = visualRange;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public List getNodes() {
+ return nodes;
+ }
+
+ public void setNodes(List nodes) {
+ this.nodes = nodes;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getIP() {
+ return ip;
+ }
+
+ public void setIP(String ip) {
+ this.ip = ip;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public String getTtl() {
+ return ttl;
+ }
+
+ public void setTtl(String ttl) {
+ this.ttl = ttl;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) {
+ return true;
+ }
+ if(obj == null) {
+ return false;
+ }
+ if(!(obj instanceof JujuDriver)) {
+ return false;
+ }
+ if(getClass() != obj.getClass()) {
+ return false;
+ }
+ JujuDriver other = (JujuDriver)obj;
+ if(serviceName == null) {
+ if(other.serviceName != null) {
+ return false;
+ }
+ } else if(!serviceName.equals(other.serviceName)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfd.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfd.java
new file mode 100644
index 0000000..bab793a
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfd.java
@@ -0,0 +1,93 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ *
+ * Juju vnfd class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class JujuVnfd {
+
+ private String downloadUri;
+
+ private String localPath;
+
+ public String getDownloadUri() {
+ return downloadUri;
+ }
+
+ public void setDownloadUri(String downloadUri) {
+ this.downloadUri = downloadUri;
+ }
+
+ public String getLocalPath() {
+ return localPath;
+ }
+
+ public void setLocalPath(String localPath) {
+ this.localPath = localPath;
+ }
+
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((downloadUri == null) ? 0 : downloadUri.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) {
+ return true;
+ }
+ if(obj == null) {
+ return false;
+ }
+ if(!(obj instanceof JujuVnfd)) {
+ return false;
+ }
+ if(getClass() != obj.getClass()) {
+ return false;
+ }
+ JujuVnfd other = (JujuVnfd)obj;
+ if(downloadUri == null) {
+ if(other.downloadUri != null) {
+ return false;
+ }
+ } else if(!downloadUri.equals(other.downloadUri)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfm.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfm.java
new file mode 100644
index 0000000..4a15e46
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfm.java
@@ -0,0 +1,366 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import net.sf.json.JSONObject;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.openo.nfvo.jujuvnfmadapter.common.CryptUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+
+/**
+ *
+ * Juju vnfm Class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class JujuVnfm {
+
+ private String id;
+
+ private String name;
+
+ private String type;
+
+ private String version;
+
+ private String userName;
+
+ private String pwd;
+
+ private String url;
+
+ private String vendor;
+
+ private String extraInfo;
+
+ private String status;
+
+ private String createAt;
+
+ private String updateAt;
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * <br>
+ *
+ * @param id
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * <br>
+ *
+ * @param type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <br>
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * <br>
+ *
+ * @param version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * <br>
+ *
+ * @param userName
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * <br>
+ *
+ * @param url
+ */
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getPwd() {
+ return pwd;
+ }
+
+ /**
+ * <br>
+ *
+ * @param pwd
+ */
+ public void setPwd(String pwd) {
+ this.pwd = pwd;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getVendor() {
+ return vendor;
+ }
+
+ /**
+ * <br>
+ *
+ * @param vendor
+ */
+ public void setVendor(String vendor) {
+ this.vendor = vendor;
+ }
+
+ /**
+ * <br>
+ *
+ * @return String
+ */
+ public String getExtraInfo() {
+ return extraInfo;
+ }
+
+ /**
+ * <br>
+ *
+ * @param extraInfo
+ */
+ public void setExtraInfo(String extraInfo) {
+ this.extraInfo = extraInfo;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * <br>
+ *
+ * @param status
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public String getCreateAt() {
+ return createAt;
+ }
+
+ /**
+ * <br>
+ *
+ * @param createAt
+ */
+ public void setCreateAt(String createAt) {
+ this.createAt = createAt;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public String getUpdateAt() {
+ return updateAt;
+ }
+
+ /**
+ * <br>
+ *
+ * @param updateAt
+ */
+ public void setUpdateAt(String updateAt) {
+ this.updateAt = updateAt;
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param obj
+ * @return
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) {
+ return true;
+ }
+ if(obj == null) {
+ return false;
+ }
+ if(!(obj instanceof JujuVnfm)) {
+ return false;
+ }
+ if(getClass() != obj.getClass()) {
+ return false;
+ }
+ JujuVnfm other = (JujuVnfm)obj;
+ if(id == null) {
+ if(other.id != null) {
+ return false;
+ }
+ } else if(!id.equals(other.id)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ * Update Vnfm.<br>
+ *
+ * @param otherVnfm
+ * @since NFVO 0.5
+ */
+ public void updateVnfm(JSONObject otherVnfm) {
+ String vnfmName = otherVnfm.getString("name");
+ String vnfmUserName = otherVnfm.getString("userName");
+ String vnfmPwd = CryptUtil.enCrypt(otherVnfm.getString("pwd"));
+
+ if(!StringUtils.isEmpty(vnfmName)) {
+ this.name = vnfmName;
+ }
+
+ if(!StringUtils.isEmpty(vnfmUserName)) {
+ this.userName = vnfmUserName;
+ }
+
+ if(!StringUtils.isEmpty(vnfmPwd)) {
+ this.pwd = vnfmPwd;
+ }
+
+ String vnfmExtraInfo = otherVnfm.get("extraInfo").toString();
+ if(!StringUtils.isEmpty(vnfmExtraInfo)) {
+ this.extraInfo = vnfmExtraInfo;
+ }
+
+ this.updateAt = new SimpleDateFormat(Constant.DATE_FORMAT).format(new Date());
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfo.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfo.java
new file mode 100644
index 0000000..d3844fa
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfo.java
@@ -0,0 +1,141 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ *
+ * @author z00292420
+ * @date 2016-9-12*
+
+ */
+public class JujuVnfmInfo implements Serializable {
+ /** */
+ private String id;
+
+ /** */
+ private String vnfmId;
+
+ /** */
+ private String vnfId;
+
+ /** */
+ private String appName;
+
+ /** */
+ private String jobId;
+
+ /** */
+ private Integer status;
+
+ /** */
+ private Date createTime;
+
+ /** */
+ private Date modifyTime;
+
+ /** */
+ private Date deleteTime;
+
+ /** */
+ private String extend;
+
+ private static final long serialVersionUID = 1L;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getVnfmId() {
+ return vnfmId;
+ }
+
+ public void setVnfmId(String vnfmId) {
+ this.vnfmId = vnfmId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ public void setModifyTime(Date modifyTime) {
+ this.modifyTime = modifyTime;
+ }
+
+ public Date getDeleteTime() {
+ return deleteTime;
+ }
+
+ public void setDeleteTime(Date deleteTime) {
+ this.deleteTime = deleteTime;
+ }
+
+ public String getExtend() {
+ return extend;
+ }
+
+ public void setExtend(String extend) {
+ this.extend = extend;
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExample.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExample.java
new file mode 100644
index 0000000..560aee8
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExample.java
@@ -0,0 +1,1682 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * JUJU VNFM Information example
+ * .</br>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 14, 2016
+ */
+public class JujuVnfmInfoExample {
+ protected String orderByClause;
+
+ protected boolean distinct;
+
+ protected List<Criteria> oredCriteria;
+
+ protected int limitStart = -1;
+
+ protected int limitEnd = -1;
+
+ public static final String VNFM_ID = "vnfmId";
+
+ public static final String VNF_ID = "vnfId";
+
+ public static final String APP_NAME = "appName";
+
+ public static final String JOB_ID = "jobId";
+
+ public static final String STATUS = "status";
+
+ public static final String CREATE_TIME = "createTime";
+
+ public static final String MODIFY_TIME = "modifyTime";
+
+ public static final String DELETE_TIME = "deleteTime";
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ */
+ public JujuVnfmInfoExample() {
+ oredCriteria = new ArrayList<>();
+ }
+
+ public void setOrderByClause(String orderByClause) {
+ this.orderByClause = orderByClause;
+ }
+
+ public String getOrderByClause() {
+ return orderByClause;
+ }
+
+ public void setDistinct(boolean distinct) {
+ this.distinct = distinct;
+ }
+
+ public boolean isDistinct() {
+ return distinct;
+ }
+
+ public List<Criteria> getOredCriteria() {
+ return oredCriteria;
+ }
+
+ /**
+ * <br>
+ *
+ * @param criteria
+ */
+ public void or(Criteria criteria) {
+ oredCriteria.add(criteria);
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria or() {
+ Criteria criteria = createCriteriaInternal();
+ oredCriteria.add(criteria);
+ return criteria;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria createCriteria() {
+ Criteria criteria = createCriteriaInternal();
+ if (oredCriteria.isEmpty()) {
+ oredCriteria.add(criteria);
+ }
+ return criteria;
+ }
+
+ protected Criteria createCriteriaInternal() {
+ return new Criteria();
+ }
+
+ /**
+ * <br>
+ *
+ */
+ public void clear() {
+ oredCriteria.clear();
+ orderByClause = null;
+ distinct = false;
+ }
+
+ public void setLimitStart(int limitStart) {
+ this.limitStart=limitStart;
+ }
+
+ public int getLimitStart() {
+ return limitStart;
+ }
+
+ public void setLimitEnd(int limitEnd) {
+ this.limitEnd=limitEnd;
+ }
+
+ public int getLimitEnd() {
+ return limitEnd;
+ }
+
+ protected static class GeneratedCriteria {
+ protected List<Criterion> criteria;
+
+ protected GeneratedCriteria() {
+ super();
+ criteria = new ArrayList<>();
+ }
+
+ public boolean isValid() {
+ return !criteria.isEmpty();
+ }
+
+ public List<Criterion> getAllCriteria() {
+ return criteria;
+ }
+
+ public List<Criterion> getCriteria() {
+ return criteria;
+ }
+
+ protected void addCriterion(String condition) {
+ if (condition == null) {
+ throw new RuntimeException("Value for condition cannot be null"); //NOSONAR
+ }
+ criteria.add(new Criterion(condition));
+ }
+
+ protected void addCriterion(String condition, Object value, String property) {
+ if (value == null) {
+ throw new RuntimeException("Value for " + property + " cannot be null"); //NOSONARr
+ }
+ criteria.add(new Criterion(condition, value));
+ }
+
+ protected void addCriterion(String condition, Object value1, Object value2, String property) {
+ if (value1 == null || value2 == null) {
+ throw new RuntimeException("Between values for " + property + " cannot be null"); //NOSONAR
+ }
+ criteria.add(new Criterion(condition, value1, value2));
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andIdIsNull() {
+ addCriterion("ID is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andIdIsNotNull() {
+ addCriterion("ID is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdEqualTo(String value) {
+ addCriterion("ID =", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdNotEqualTo(String value) {
+ addCriterion("ID <>", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdGreaterThan(String value) {
+ addCriterion("ID >", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdGreaterThanOrEqualTo(String value) {
+ addCriterion("ID >=", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdLessThan(String value) {
+ addCriterion("ID <", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdLessThanOrEqualTo(String value) {
+ addCriterion("ID <=", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdLike(String value) {
+ addCriterion("ID like", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andIdNotLike(String value) {
+ addCriterion("ID not like", value, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andIdIn(List<String> values) {
+ addCriterion("ID in", values, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andIdNotIn(List<String> values) {
+ addCriterion("ID not in", values, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andIdBetween(String value1, String value2) {
+ addCriterion("ID between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andIdNotBetween(String value1, String value2) {
+ addCriterion("ID not between", value1, value2, "id");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andVnfmIdIsNull() {
+ addCriterion("VNFM_ID is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andVnfmIdIsNotNull() {
+ addCriterion("VNFM_ID is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdEqualTo(String value) {
+ addCriterion("VNFM_ID =", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdNotEqualTo(String value) {
+ addCriterion("VNFM_ID <>", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdGreaterThan(String value) {
+ addCriterion("VNFM_ID >", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdGreaterThanOrEqualTo(String value) {
+ addCriterion("VNFM_ID >=", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdLessThan(String value) {
+ addCriterion("VNFM_ID <", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdLessThanOrEqualTo(String value) {
+ addCriterion("VNFM_ID <=", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdLike(String value) {
+ addCriterion("VNFM_ID like", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfmIdNotLike(String value) {
+ addCriterion("VNFM_ID not like", value, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andVnfmIdIn(List<String> values) {
+ addCriterion("VNFM_ID in", values, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andVnfmIdNotIn(List<String> values) {
+ addCriterion("VNFM_ID not in", values, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andVnfmIdBetween(String value1, String value2) {
+ addCriterion("VNFM_ID between", value1, value2, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andVnfmIdNotBetween(String value1, String value2) {
+ addCriterion("VNFM_ID not between", value1, value2, VNFM_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andVnfIdIsNull() {
+ addCriterion("VNF_ID is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andVnfIdIsNotNull() {
+ addCriterion("VNF_ID is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdEqualTo(String value) {
+ addCriterion("VNF_ID =", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdNotEqualTo(String value) {
+ addCriterion("VNF_ID <>", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdGreaterThan(String value) {
+ addCriterion("VNF_ID >", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdGreaterThanOrEqualTo(String value) {
+ addCriterion("VNF_ID >=", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdLessThan(String value) {
+ addCriterion("VNF_ID <", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdLessThanOrEqualTo(String value) {
+ addCriterion("VNF_ID <=", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdLike(String value) {
+ addCriterion("VNF_ID like", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andVnfIdNotLike(String value) {
+ addCriterion("VNF_ID not like", value, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andVnfIdIn(List<String> values) {
+ addCriterion("VNF_ID in", values, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andVnfIdNotIn(List<String> values) {
+ addCriterion("VNF_ID not in", values, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andVnfIdBetween(String value1, String value2) {
+ addCriterion("VNF_ID between", value1, value2, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andVnfIdNotBetween(String value1, String value2) {
+ addCriterion("VNF_ID not between", value1, value2, VNF_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andAppNameIsNull() {
+ addCriterion("APP_NAME is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andAppNameIsNotNull() {
+ addCriterion("APP_NAME is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameEqualTo(String value) {
+ addCriterion("APP_NAME =", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameNotEqualTo(String value) {
+ addCriterion("APP_NAME <>", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameGreaterThan(String value) {
+ addCriterion("APP_NAME >", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameGreaterThanOrEqualTo(String value) {
+ addCriterion("APP_NAME >=", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameLessThan(String value) {
+ addCriterion("APP_NAME <", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameLessThanOrEqualTo(String value) {
+ addCriterion("APP_NAME <=", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameLike(String value) {
+ addCriterion("APP_NAME like", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andAppNameNotLike(String value) {
+ addCriterion("APP_NAME not like", value, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andAppNameIn(List<String> values) {
+ addCriterion("APP_NAME in", values, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andAppNameNotIn(List<String> values) {
+ addCriterion("APP_NAME not in", values, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andAppNameBetween(String value1, String value2) {
+ addCriterion("APP_NAME between", value1, value2, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andAppNameNotBetween(String value1, String value2) {
+ addCriterion("APP_NAME not between", value1, value2, APP_NAME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andJobIdIsNull() {
+ addCriterion("JOB_ID is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andJobIdIsNotNull() {
+ addCriterion("JOB_ID is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdEqualTo(String value) {
+ addCriterion("JOB_ID =", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdNotEqualTo(String value) {
+ addCriterion("JOB_ID <>", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdGreaterThan(String value) {
+ addCriterion("JOB_ID >", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdGreaterThanOrEqualTo(String value) {
+ addCriterion("JOB_ID >=", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdLessThan(String value) {
+ addCriterion("JOB_ID <", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdLessThanOrEqualTo(String value) {
+ addCriterion("JOB_ID <=", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdLike(String value) {
+ addCriterion("JOB_ID like", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andJobIdNotLike(String value) {
+ addCriterion("JOB_ID not like", value, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andJobIdIn(List<String> values) {
+ addCriterion("JOB_ID in", values, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andJobIdNotIn(List<String> values) {
+ addCriterion("JOB_ID not in", values, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andJobIdBetween(String value1, String value2) {
+ addCriterion("JOB_ID between", value1, value2, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andJobIdNotBetween(String value1, String value2) {
+ addCriterion("JOB_ID not between", value1, value2, JOB_ID);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andStatusIsNull() {
+ addCriterion("STATUS is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andStatusIsNotNull() {
+ addCriterion("STATUS is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andStatusEqualTo(Integer value) {
+ addCriterion("STATUS =", value, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andStatusNotEqualTo(Integer value) {
+ addCriterion("STATUS <>", value, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andStatusGreaterThan(Integer value) {
+ addCriterion("STATUS >", value, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
+ addCriterion("STATUS >=", value, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andStatusLessThan(Integer value) {
+ addCriterion("STATUS <", value, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andStatusLessThanOrEqualTo(Integer value) {
+ addCriterion("STATUS <=", value, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andStatusIn(List<Integer> values) {
+ addCriterion("STATUS in", values, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andStatusNotIn(List<Integer> values) {
+ addCriterion("STATUS not in", values, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andStatusBetween(Integer value1, Integer value2) {
+ addCriterion("STATUS between", value1, value2, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andStatusNotBetween(Integer value1, Integer value2) {
+ addCriterion("STATUS not between", value1, value2, STATUS);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andCreateTimeIsNull() {
+ addCriterion("CREATE_TIME is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andCreateTimeIsNotNull() {
+ addCriterion("CREATE_TIME is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andCreateTimeEqualTo(Date value) {
+ addCriterion("CREATE_TIME =", value, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andCreateTimeNotEqualTo(Date value) {
+ addCriterion("CREATE_TIME <>", value, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andCreateTimeGreaterThan(Date value) {
+ addCriterion("CREATE_TIME >", value, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+ addCriterion("CREATE_TIME >=", value, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andCreateTimeLessThan(Date value) {
+ addCriterion("CREATE_TIME <", value, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+ addCriterion("CREATE_TIME <=", value, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andCreateTimeIn(List<Date> values) {
+ addCriterion("CREATE_TIME in", values, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andCreateTimeNotIn(List<Date> values) {
+ addCriterion("CREATE_TIME not in", values, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andCreateTimeBetween(Date value1, Date value2) {
+ addCriterion("CREATE_TIME between", value1, value2, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+ addCriterion("CREATE_TIME not between", value1, value2, CREATE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andModifyTimeIsNull() {
+ addCriterion("MODIFY_TIME is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andModifyTimeIsNotNull() {
+ addCriterion("MODIFY_TIME is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andModifyTimeEqualTo(Date value) {
+ addCriterion("MODIFY_TIME =", value, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andModifyTimeNotEqualTo(Date value) {
+ addCriterion("MODIFY_TIME <>", value, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andModifyTimeGreaterThan(Date value) {
+ addCriterion("MODIFY_TIME >", value, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andModifyTimeGreaterThanOrEqualTo(Date value) {
+ addCriterion("MODIFY_TIME >=", value, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andModifyTimeLessThan(Date value) {
+ addCriterion("MODIFY_TIME <", value, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andModifyTimeLessThanOrEqualTo(Date value) {
+ addCriterion("MODIFY_TIME <=", value, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andModifyTimeIn(List<Date> values) {
+ addCriterion("MODIFY_TIME in", values, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andModifyTimeNotIn(List<Date> values) {
+ addCriterion("MODIFY_TIME not in", values, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andModifyTimeBetween(Date value1, Date value2) {
+ addCriterion("MODIFY_TIME between", value1, value2, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andModifyTimeNotBetween(Date value1, Date value2) {
+ addCriterion("MODIFY_TIME not between", value1, value2, MODIFY_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andDeleteTimeIsNull() {
+ addCriterion("DELETE_TIME is null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Criteria andDeleteTimeIsNotNull() {
+ addCriterion("DELETE_TIME is not null");
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andDeleteTimeEqualTo(Date value) {
+ addCriterion("DELETE_TIME =", value, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andDeleteTimeNotEqualTo(Date value) {
+ addCriterion("DELETE_TIME <>", value, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andDeleteTimeGreaterThan(Date value) {
+ addCriterion("DELETE_TIME >", value, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andDeleteTimeGreaterThanOrEqualTo(Date value) {
+ addCriterion("DELETE_TIME >=", value, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andDeleteTimeLessThan(Date value) {
+ addCriterion("DELETE_TIME <", value, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value
+ * @return
+ */
+ public Criteria andDeleteTimeLessThanOrEqualTo(Date value) {
+ addCriterion("DELETE_TIME <=", value, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andDeleteTimeIn(List<Date> values) {
+ addCriterion("DELETE_TIME in", values, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param values
+ * @return
+ */
+ public Criteria andDeleteTimeNotIn(List<Date> values) {
+ addCriterion("DELETE_TIME not in", values, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andDeleteTimeBetween(Date value1, Date value2) {
+ addCriterion("DELETE_TIME between", value1, value2, DELETE_TIME);
+ return (Criteria) this;
+ }
+
+ /**
+ * <br>
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public Criteria andDeleteTimeNotBetween(Date value1, Date value2) {
+ addCriterion("DELETE_TIME not between", value1, value2, DELETE_TIME);
+ return (Criteria) this;
+ }
+ }
+
+ /**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author z00292420
+ * @date 2016-9-14
+ */
+ public static class Criteria extends GeneratedCriteria {
+
+ protected Criteria() {
+ super();
+ }
+ }
+
+ /**
+ * Criterion
+ * .</br>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 14, 2016
+ */
+ public static class Criterion {
+ private String condition;
+
+ private Object value;
+
+ private Object secondValue;
+
+ private boolean noValue;
+
+ private boolean singleValue;
+
+ private boolean betweenValue;
+
+ private boolean listValue;
+
+ private String typeHandler;
+
+
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @param condition
+ */
+ protected Criterion(String condition) {
+ super();
+ this.condition = condition;
+ this.typeHandler = null;
+ this.noValue = true;
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @param condition
+ * @param value
+ * @param typeHandler
+ */
+ protected Criterion(String condition, Object value, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.typeHandler = typeHandler;
+ if (value instanceof List<?>) {
+ this.listValue = true;
+ } else {
+ this.singleValue = true;
+ }
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @param condition
+ * @param value
+ */
+ protected Criterion(String condition, Object value) {
+ this(condition, value, null);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @param condition
+ * @param value
+ * @param secondValue
+ * @param typeHandler
+ */
+ protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+ super();
+ this.condition = condition;
+ this.value = value;
+ this.secondValue = secondValue;
+ this.typeHandler = typeHandler;
+ this.betweenValue = true;
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @param condition
+ * @param value
+ * @param secondValue
+ */
+ protected Criterion(String condition, Object value, Object secondValue) {
+ this(condition, value, secondValue, null);
+ }
+
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public String getCondition() {
+ return condition;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public Object getSecondValue() {
+ return secondValue;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public boolean isNoValue() {
+ return noValue;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public boolean isSingleValue() {
+ return singleValue;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public boolean isBetweenValue() {
+ return betweenValue;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public boolean isListValue() {
+ return listValue;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ */
+ public String getTypeHandler() {
+ return typeHandler;
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntity.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntity.java
new file mode 100644
index 0000000..4ac27f2
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntity.java
@@ -0,0 +1,370 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+
+/**
+ * <br/>
+ * <p>
+ * The request parameters of Register service to the Microservice Bus
+ * URL-path: /openoapi/microservices/v1/services
+ * example:
+ * {
+ * "serviceName": "catalog",
+ * "version": "v1",
+ * "url": "/openoapi/catalog/v1",
+ * "protocol": "REST",
+ * "visualRange": ["1"],
+ * "nodes": [
+ * {
+ * "ip": "10.74.56.36",
+ * "port": "8988",
+ * "ttl": 0
+ * }
+ * ]
+ * }
+ * </p>
+ * <p>
+ * the response example:
+ * {
+ * "serviceName": "catalog",
+ * "version": "v1",
+ * "url": "/openoapi/catalog/v1",
+ * "protocol": "REST",
+ * "visualRange": ["1"],
+ * "nodes": [
+ * {
+ * "ip": "10.74.55.66",
+ * "port": "6666",
+ * "ttl": 0,
+ * "expiration": "2016-02-18T16:19:40+08:00",
+ * "created_at": "2016-02-18T16:03:00+08:00",
+ * "updated_at": "2016-02-18T16:03:00+08:00"
+ * },
+ * {
+ * "ip": "10.74.56.37",
+ * "port": "8989",
+ * "ttl": 0,
+ * "expiration": "2016-02-18T16:13:00+08:00",
+ * "created_at": "2016-02-18T16:03:00+08:00",
+ * "updated_at": "2016-02-18T16:03:00+08:00"
+ * },
+ * {
+ * "ip": "10.74.56.36",
+ * "port": "8988",
+ * "ttl": 0,
+ * "expiration": "2016-02-18T17:04:36+08:00",
+ * "created_at": "2016-02-18T16:03:00+08:00",
+ * "updated_at": "2016-02-18T16:03:00+08:00"
+ * }
+ * ],
+ * "status": "1"
+ * }
+ * the params description:
+ * serviceName: service name
+ * version: version
+ * url: url of the created service instance
+ * protocol: supported protocols: 'REST', 'UI'
+ * nodes: the service instance nodes list to register
+ * ip: the ip of the service instance node, it could also be a hostname like catalog.openo.org
+ * port: the port of the service instance node
+ * ttl: time to live, this parameter is reserved for later use
+ * status: service status, 1: eanbled, 0:disabled
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 18, 2016
+ */
+public class MSBRequestEntity implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4548158998952436572L;
+
+ private String serviceName;
+
+ private String version;
+
+ /**
+ * the actual URL of the service to be registered
+ */
+ private String url;
+
+ /**
+ * supported protocols: 'REST', 'UI'
+ */
+ private String protocol = "REST";
+
+ /**
+ * Visibility of the service.
+ * External(can be accessed by external systems):0
+ * Internal(can only be accessed by OPEN-O consumers):1
+ */
+ private String visualRange = "1";
+
+ /**
+ * only exist in response;
+ * status: service status, 1: eanbled, 0:disabled
+ */
+ private String status;
+
+ /**
+ * ip: the ip of the service instance node, it could also be a hostname like catalog.openo.org
+ * port: the port of the service instance node
+ * ttl: time to live, this parameter is reserved for later use
+ */
+ private List<Node> nodes;
+
+ /**
+ * @return Returns the serviceName.
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * @param serviceName The serviceName to set.
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @return Returns the version.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * @param version The version to set.
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * @return Returns the url.
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * @param url The url to set.
+ */
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ /**
+ * @return Returns the protocol.
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * @param protocol The protocol to set.
+ */
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ /**
+ * @return Returns the visualRange.
+ */
+ public String getVisualRange() {
+ return visualRange;
+ }
+
+ /**
+ * @param visualRange The visualRange to set.
+ */
+ public void setVisualRange(String visualRange) {
+ this.visualRange = visualRange;
+ }
+
+ /**
+ * @return Returns the status.
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @param status The status to set.
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * @return Returns the nodes.
+ */
+ public List<Node> getNodes() {
+ return nodes;
+ }
+
+ /**
+ * @param nodes The nodes to set.
+ */
+ public void setNodes(List<Node> nodes) {
+ this.nodes = nodes;
+ }
+
+ /**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 18, 2016
+ */
+ public static class Node implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7618395945064516270L;
+
+ private String ip;
+
+ private String port;
+
+ private String ttl;
+
+ private String expiration;
+
+ private String createdAt;
+
+ private String updatedAt;
+
+ /**
+ * @return Returns the ip.
+ */
+ public String getIp() {
+ return ip;
+ }
+
+ /**
+ * @param ip The ip to set.
+ */
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ /**
+ * @return Returns the port.
+ */
+ public String getPort() {
+ return port;
+ }
+
+ /**
+ * @param port The port to set.
+ */
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ /**
+ * @return Returns the ttl.
+ */
+ public String getTtl() {
+ return ttl;
+ }
+
+ /**
+ * @param ttl The ttl to set.
+ */
+ public void setTtl(String ttl) {
+ this.ttl = ttl;
+ }
+
+ /**
+ * @return Returns the expiration.
+ */
+ public String getExpiration() {
+ return expiration;
+ }
+
+ /**
+ * @param expiration The expiration to set.
+ */
+ public void setExpiration(String expiration) {
+ this.expiration = expiration;
+ }
+
+ /**
+ * @return Returns the created_at.
+ */
+ public String getCreatedAt() {
+ return createdAt;
+ }
+
+ /**
+ * @param createdAt The created_at to set.
+ */
+ public void setCreatedAt(String createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ /**
+ * @return Returns the updated_at.
+ */
+ public String getUpdatedAt() {
+ return updatedAt;
+ }
+
+ /**
+ * @param updatedAt The updated_at to set.
+ */
+ public void setUpdatedAt(String updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since NFVO 0.5
+ */
+ @Override
+ public String toString() {
+ return EntityUtils.toString(this, Node.class);
+ }
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since NFVO 0.5
+ */
+ @Override
+ public String toString() {
+ return EntityUtils.toString(this, MSBRequestEntity.class);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/Vnfm.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/Vnfm.java
new file mode 100644
index 0000000..b08b2f5
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/Vnfm.java
@@ -0,0 +1,232 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import net.sf.json.JSONObject;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.openo.nfvo.jujuvnfmadapter.common.CryptUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+
+/**
+ *
+ * VNFM class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 12, 2016
+ */
+public class Vnfm {
+
+ private String id;
+
+ private String name;
+
+ private String type;
+
+ private String version;
+
+ private String userName;
+
+ private String pwd;
+
+ private String url;
+
+ private String sites;
+
+ private String extraInfo;
+
+ private String status;
+
+ private String createAt;
+
+ private String updateAt;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getPwd() {
+ return pwd;
+ }
+
+ public void setPwd(String pwd) {
+ this.pwd = pwd;
+ }
+
+ public String getSites() {
+ return sites;
+ }
+
+ public void setSites(String sites) {
+ this.sites = sites;
+ }
+
+ public String getExtraInfo() {
+ return extraInfo;
+ }
+
+ public void setExtraInfo(String extraInfo) {
+ this.extraInfo = extraInfo;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getCreateAt() {
+ return createAt;
+ }
+
+ public void setCreateAt(String createAt) {
+ this.createAt = createAt;
+ }
+
+ public String getUpdateAt() {
+ return updateAt;
+ }
+
+ public void setUpdateAt(String updateAt) {
+ this.updateAt = updateAt;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) {
+ return true;
+ }
+ if(obj == null) {
+ return false;
+ }
+ if(!(obj instanceof Vnfm)) {
+ return false;
+ }
+ if(getClass() != obj.getClass()) {
+ return false;
+ }
+ Vnfm other = (Vnfm)obj;
+ if(id == null) {
+ if(other.id != null) {
+ return false;
+ }
+ } else if(!id.equals(other.id)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ * Update Vnfm.<br>
+ *
+ * @param otherVnfm
+ * @since NFVO 0.5
+ */
+ public void updateVnfm(JSONObject otherVnfm) {
+ String vnfmName = otherVnfm.getString("name");
+ String vnfmUserName = otherVnfm.getString("userName");
+ String vnfmPwd = CryptUtil.enCrypt(otherVnfm.getString("pwd"));
+
+ if(!StringUtils.isEmpty(vnfmName)) {
+ this.name = vnfmName;
+ }
+
+ if(!StringUtils.isEmpty(vnfmUserName)) {
+ this.userName = vnfmUserName;
+ }
+
+ if(!StringUtils.isEmpty(vnfmPwd)) {
+ this.pwd = vnfmPwd;
+ }
+
+ String vnfmExtraInfo = otherVnfm.get("extraInfo").toString();
+ if(!StringUtils.isEmpty(vnfmExtraInfo)) {
+ this.extraInfo = vnfmExtraInfo;
+ }
+
+ this.updateAt = new SimpleDateFormat(Constant.DATE_FORMAT).format(new Date());
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResult.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResult.java
new file mode 100644
index 0000000..9c3e626
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResult.java
@@ -0,0 +1,125 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * Vnfm operation result class.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 10, 2016
+ */
+public class VnfmOpResult {
+
+ private String errorMessage;
+
+ /**
+ *
+ * Task status enumerator.<br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 10, 2016
+ */
+ public enum TaskStatus {
+ INIT, SUCCESS, FAIL, PART_SUCCESS, RUNNING, TIMEOUT
+ }
+
+ private TaskStatus operateStatus;
+
+ private List<Object> results = new ArrayList<>(10);
+
+ private int errorCode;
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @since NFVO 0.5
+ */
+ public VnfmOpResult() {
+ operateStatus = TaskStatus.INIT;
+ errorMessage = "";
+ errorCode = 0;
+ }
+
+ /**
+ *
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param operateStatus
+ * @param errorMessage
+ * @since NFVO 0.5
+ */
+ public VnfmOpResult(TaskStatus operateStatus, String errorMessage) {
+ this.operateStatus = operateStatus;
+ this.errorMessage = errorMessage;
+ errorCode = 0;
+ }
+
+ public void setOperateStatus(TaskStatus operateStatus) {
+ this.operateStatus = operateStatus;
+ }
+
+ public TaskStatus getOperateStatus() {
+ return operateStatus;
+ }
+
+ public List<Object> getResult() {
+ return results;
+ }
+
+ /**
+ *
+ * Add Result.<br>
+ *
+ * @param result
+ * @since NFVO 0.5
+ */
+ @SuppressWarnings("unchecked")
+ public void addResult(Object result) {
+ if(result instanceof List<?>) {
+ this.results.addAll((List<Object>)result);
+ } else {
+ this.results.add(result);
+ }
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getName() + "@[" + "operateStatus=" + operateStatus + ", " + "errorCode=" + errorCode + ", " +
+ "errorMessage=" + errorMessage + "]";
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationException.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationException.java
new file mode 100644
index 0000000..4d213e5
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationException.java
@@ -0,0 +1,34 @@
+/*
+ * 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.jujuvnfmadapter.service.exception;
+
+/**
+ * <br/>
+ * <p>
+ *
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 18, 2016
+ */
+public class UnsupportedOperationException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7599989642681309581L;
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuClientUtils.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuClientUtils.java
new file mode 100644
index 0000000..1e72f04
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuClientUtils.java
@@ -0,0 +1,97 @@
+/*
+ * 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.jujuvnfmadapter.service.juju;
+
+import org.python.core.PyInteger;
+import org.python.core.PyObject;
+import org.python.core.PyString;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 22, 2016
+ */
+public class JujuClientUtils {
+
+ private static PyObjectFactory factory ;
+
+
+ private JujuClientUtils() {
+ // private constructor
+ }
+
+ /**
+ * call this to connect JUJU VNFM
+ * <br/>
+ *
+ * @param envName
+ * @since NFVO 0.5
+ */
+ public static void init(String envName){
+ factory = PyObjectFactory.build(envName);
+ }
+
+ /**
+ * <br>
+ *
+ * @param serviceName
+ * @param charmUrl
+ * @return pyObject
+ */
+ public static PyObject setCharm(String serviceName,String charmUrl){
+ return factory.execute("set_charm", new PyString(serviceName), new PyString(charmUrl));
+ }
+ /**
+ * <br>
+ *
+ * @param vnfInstanceId
+ * @param vnfmId
+ * @return pyObject
+ */
+ public static PyObject getVnfStatus(String vnfInstanceId,String vnfmId){
+ return null;
+ }
+
+ /**
+ * <br>
+ *
+ * @param serviceName
+ * @param charmUrl
+ * @param numUnits
+ * @return pyObject
+ */
+ public static PyObject deployService(String serviceName,String charmUrl, int numUnits){
+ PyObject[] arrys = new PyObject[]{new PyString(serviceName), new PyString(charmUrl), new PyInteger(numUnits)};
+ return factory.execute("deploy", arrys);
+ }
+ /**
+ * Destory a service and all of it's units.
+ * <br/>
+ *
+ * @param serviceName
+ * @param charmUrl
+ * @param numUnits
+ * @return
+ * @since NFVO 0.5
+ */
+ public static PyObject destoryService(String serviceName){
+ return factory.execute("deploy",new PyString(serviceName));
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuHelper.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuHelper.java
new file mode 100644
index 0000000..ae0bffa
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/JujuHelper.java
@@ -0,0 +1,54 @@
+/*
+ * 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.jujuvnfmadapter.service.juju;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Nov 4, 2016
+ */
+public class JujuHelper {
+
+ /**
+ * 1\ toLowerCase
+ * 2\remove the extension
+ * 3\remove the underline
+ * <br/>
+ *
+ * @param appName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static String getModelName(String appName){
+ if(StringUtils.isBlank(appName)){
+ return appName;
+ }
+ char c = '.';
+ String modelName = appName;
+ modelName = modelName.toLowerCase();
+ if(modelName.indexOf(c) > -1){
+ modelName = modelName.substring(0,modelName.indexOf(c));
+ }
+ return modelName.replaceAll("_", "");
+
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/PyObjectFactory.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/PyObjectFactory.java
new file mode 100644
index 0000000..2d98290
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/PyObjectFactory.java
@@ -0,0 +1,104 @@
+/*
+ * 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.jujuvnfmadapter.service.juju;
+
+import org.python.core.PyObject;
+import org.python.core.PyString;
+import org.python.util.PythonInterpreter;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 22, 2016
+ */
+public class PyObjectFactory {
+
+ private static PyObject environmentClass;
+
+ private static PyObject environmentObj;
+
+ /**
+ * <br>
+ *
+ * @param envName
+ * @return
+ * @since NFVO 0.5
+ */
+ public static PyObjectFactory build(String envName) {
+ PythonInterpreter interpreter = new PythonInterpreter();
+
+ interpreter.exec("from jujuclient import Environment");
+
+ environmentClass = interpreter.get("Environment");
+ PyObject env = environmentClass.__call__();
+ environmentObj = env.invoke("connect", new PyString(envName));
+ return new PyObjectFactory();
+ }
+
+ /**
+ * <br>
+ *
+ * @param methodName
+ * @return
+ * @since NFVO 0.5
+ */
+ public PyObject execute(String methodName) {
+ environmentObj.toString();
+ return environmentObj.invoke(methodName);
+ }
+
+ /**
+ * <br>
+ *
+ * @param methodName
+ * @param args
+ * @return
+ * @since NFVO 0.5
+ */
+ public PyObject execute(String methodName, PyObject args) {
+ return environmentObj.invoke(methodName, args);
+ }
+
+ /**
+ * <br>
+ *
+ * @param methodName
+ * @param arg1
+ * @param arg2
+ * @return
+ * @since NFVO 0.5
+ */
+ public PyObject execute(String methodName, PyObject arg1, PyObject arg2) {
+ return environmentObj.invoke(methodName, arg1, arg2);
+ }
+
+ /**
+ * <br>
+ *
+ * @param methodName
+ * @param args
+ * @return
+ * @since NFVO 0.5
+ */
+ public PyObject execute(String methodName, PyObject[] args) {
+ return environmentObj.invoke(methodName, args);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Config.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Config.java
new file mode 100644
index 0000000..21c0cbc
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Config.java
@@ -0,0 +1,45 @@
+/*
+ * 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.jujuvnfmadapter.service.juju.config;
+
+import java.util.Map;
+
+/**
+ * Created by QuanZhong on 2016/12/1.
+ */
+public class Config {
+ public Config(Map<String, ConfigItem> options) {
+ this.options = options;
+ }
+
+ private Map<String,ConfigItem> options;
+
+ public Map<String, ConfigItem> getOptions() {
+ return options;
+ }
+
+ public void setOptions(Map<String, ConfigItem> options) {
+ this.options = options;
+ }
+
+ @Override
+ public String toString() {
+ return "Config{" +
+ "options=" + options +
+ '}';
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItem.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItem.java
new file mode 100644
index 0000000..7edf0b5
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItem.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.jujuvnfmadapter.service.juju.config;
+
+/**
+ * Created by QuanZhong on 2016/12/1.
+ */
+public class ConfigItem {
+
+ private String defaults;
+ private String description;
+ private String type;
+
+ public String getDefaults() {
+ return defaults;
+ }
+
+ public void setDefaults(String defaults) {
+ this.defaults = defaults;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "ConfigItem{" +
+ "defaults='" + defaults + '\'' +
+ ", description='" + description + '\'' +
+ ", type='" + type + '\'' +
+ '}';
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Options.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Options.java
new file mode 100644
index 0000000..110b9a2
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/Options.java
@@ -0,0 +1,23 @@
+/*
+ * 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.jujuvnfmadapter.service.juju.config;
+
+/**
+ * Created by QuanZhong on 2016/12/1.
+ */
+public class Options {
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/mapper/JujuVnfmInfoMapper.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/mapper/JujuVnfmInfoMapper.java
new file mode 100644
index 0000000..2b2da41
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/mapper/JujuVnfmInfoMapper.java
@@ -0,0 +1,149 @@
+/*
+ * 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.jujuvnfmadapter.service.mapper;
+
+import java.util.List;
+
+
+import org.apache.ibatis.annotations.Param;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 14, 2016
+ */
+public interface JujuVnfmInfoMapper {
+ /**
+ * <br>
+ *
+ * @param example
+ * @return int
+ */
+ int countByExample(JujuVnfmInfoExample example);
+
+ /**
+ * <br>
+ *
+ * @param example
+ * @return int
+ */
+ int deleteByExample(JujuVnfmInfoExample example);
+
+ /**
+ * <br>
+ *
+ * @param id
+ * @return int
+ */
+ int deleteByPrimaryKey(String id);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @return int
+ */
+ int insert(JujuVnfmInfo record);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @return int
+ */
+ int insertSelective(JujuVnfmInfo record);
+
+ /**
+ * <br>
+ *
+ * @param example
+ * @return list
+ */
+ List<JujuVnfmInfo> selectByExampleWithBLOBs(JujuVnfmInfoExample example);
+
+ /**
+ * <br>
+ *
+ * @param example
+ * @return list
+ */
+ List<JujuVnfmInfo> selectByExample(JujuVnfmInfoExample example);
+
+ /**
+ * <br>
+ *
+ * @param id
+ * @return jujuVnfmInfo
+ */
+ JujuVnfmInfo selectByPrimaryKey(String id);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @param example
+ * @return int
+ */
+ int updateByExampleSelective(@Param("record") JujuVnfmInfo record, @Param("example") JujuVnfmInfoExample example);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @param example
+ * @return int
+ */
+ int updateByExampleWithBLOBs(@Param("record") JujuVnfmInfo record, @Param("example") JujuVnfmInfoExample example);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @param example
+ * @return int
+ */
+ int updateByExample(@Param("record") JujuVnfmInfo record, @Param("example") JujuVnfmInfoExample example);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @return int
+ */
+ int updateByPrimaryKeySelective(JujuVnfmInfo record);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @return int
+ */
+ int updateByPrimaryKeyWithBLOBs(JujuVnfmInfo record);
+
+ /**
+ * <br>
+ *
+ * @param record
+ * @return int
+ */
+ int updateByPrimaryKey(JujuVnfmInfo record);
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgr.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgr.java
new file mode 100644
index 0000000..8dc6070
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgr.java
@@ -0,0 +1,403 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.process;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.SwitchController;
+import org.openo.nfvo.jujuvnfmadapter.common.VnfmUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IResourceManager;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample;
+import org.openo.nfvo.jujuvnfmadapter.service.mapper.JujuVnfmInfoMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONException;
+import net.sf.json.JSONObject;
+
+/**
+ * Provide function for instantiate or terminate VNF
+ * <br/>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 24, 2016
+ */
+public class VnfMgr {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfMgr.class);
+ private JujuVnfmInfoMapper jujuVnfmInfoMapper;
+ private IResourceManager resourceManager;
+
+ public IResourceManager getResourceManager() {
+ return resourceManager;
+ }
+
+ public void setResourceManager(IResourceManager resourceManager) {
+ this.resourceManager = resourceManager;
+ }
+
+ /**
+ * @return Returns the jujuVnfmInfoMapper.
+ */
+ public JujuVnfmInfoMapper getJujuVnfmInfoMapper() {
+ return jujuVnfmInfoMapper;
+ }
+
+
+ /**
+ * @param jujuVnfmInfoMapper The jujuVnfmInfoMapper to set.
+ */
+ public void setJujuVnfmInfoMapper(JujuVnfmInfoMapper jujuVnfmInfoMapper) {
+ this.jujuVnfmInfoMapper = jujuVnfmInfoMapper;
+ }
+
+ /**
+ * Provide function for instantiate VNF
+ * <br/>
+ *
+ * @param vnfObject
+ * @param vnfmId
+ * @return
+ * @since NFVO 0.5
+ */
+ public JSONObject addVnf(JSONObject vnfObject, String vnfmId) {
+ JSONObject restJson = new JSONObject();
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL);
+ try {
+
+ if(vnfObject.isNullObject() || vnfObject.isEmpty()) {
+ return restJson;
+ }
+ String vnfInstanceName = vnfObject.getString("vnfInstanceName");
+ String csarId = vnfObject.getString("vnfPackageId");
+ String url = null;
+ try {
+ url = vnfObject.getString("vnfmServiceUrl");
+ } catch (Exception e) {
+ LOG.warn("the value 'vnfmServiceUrl' not exist."+e.getMessage());
+ }
+ if (StringUtils.isBlank(url)) {
+ url = SwitchController.vnfmServiceUrl;
+ }
+ if (StringUtils.isBlank(url)) {
+ JSONObject vnfmObject = VnfmUtil.getVnfmById(vnfmId);
+
+ if(vnfmObject == null || vnfmObject.isNullObject()) {
+ LOG.error("function=addVnf, msg=Unable to get the jujuvnfm info from the 'ESR', vnfmId: {}", vnfmId);
+ return restJson;
+ }
+ url = vnfmObject.getString("url");
+ }
+ //call juju-cliento deploy
+ JSONObject params = new JSONObject();
+ params.put(Constant.VNFM_ID, vnfmId);
+ params.put("appName", vnfInstanceName);
+ params.put("csarId", csarId);
+
+
+ Map<String, String> paramsMap = new HashMap<>(6);
+ paramsMap.put("url", url);
+ paramsMap.put(Constant.METHOD_TYPE, Constant.POST);
+ paramsMap.put("path", UrlConstant.REST_JUJU_CLIENT_DEPLOY);
+ paramsMap.put(Constant.AUTH_MODE, Constant.AuthenticationMode.ANONYMOUS);
+ RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(paramsMap, params.toString(), null);
+ if(rsp == null) {
+ LOG.error("function=addVnf, msg=send create vnf msg to csm get wrong results");
+ return restJson;
+ }
+
+ int statusCode = rsp.getStatus();
+ if(statusCode == Constant.HTTP_CREATED || statusCode == Constant.HTTP_OK) {
+ JSONObject res = JSONObject.fromObject(rsp.getResponseContent());
+ String vnfId = res.getString("vnfId");
+ saveJujuVnfmInfo(vnfInstanceName,vnfId,vnfId,vnfmId,vnfObject);
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_SUCCESS);
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("vnfInstanceId", vnfId);
+ resultObj.put("jobId", vnfId + "_" + Constant.POST);
+ restJson.put("data", resultObj);
+ } else {
+ LOG.error("function=createVnf, msg=send create vnf msg to csm get wrong status: " + statusCode);
+ }
+
+ } catch(JSONException e) {
+ LOG.error("function=addVnf, msg=JSONException occurs, e={}.", e);
+ }
+ LOG.info("request:{},response:{}", vnfmId, restJson.toString());
+ return restJson;
+ }
+
+ /**
+ *
+ * <br/>
+ *
+ * @param csarId
+ * @return
+ * @since NFVO 0.5
+ */
+ public String getCharmPath(String csarId){
+ try {
+ JSONObject res = resourceManager.getVnfdInfo(csarId);
+ if(res != null && res.getString("csarFilePath") != null){
+ return res.getString("csarFilePath");
+ }
+ } catch(Exception e) {
+ LOG.error("get charmPath fail:csarId="+csarId,e);
+ }
+ LOG.warn("get charmPath fail:csarId="+csarId);
+ return null;
+ }
+ /**
+ * save object to db
+ * <br/>
+ *
+ * @param appName
+ * @param jobId
+ * @param vnfId
+ * @param vnfmId
+ * @since NFVO 0.5
+ */
+ private void saveJujuVnfmInfo(String appName,String jobId,String vnfId,String vnfmId, JSONObject vnfObject){
+ JujuVnfmInfo record = new JujuVnfmInfo();
+ record.setId(UUID.randomUUID().toString());
+ record.setAppName(appName);
+ record.setJobId(jobId);
+ record.setVnfId(vnfId);
+ record.setVnfmId(vnfmId);
+ record.setStatus(0);
+ record.setCreateTime(new Date());
+ record.setModifyTime(new Date());
+ record.setExtend(vnfObject.toString());
+ jujuVnfmInfoMapper.insert(record);
+ }
+ /**
+ * delete the object by vnfid
+ * <br/>
+ *
+ * @param vnfId
+ * @since NFVO 0.5
+ */
+ private void delJujuVnfmInfo(String vnfId){
+ JujuVnfmInfoExample example = new JujuVnfmInfoExample();
+ example.createCriteria().andVnfIdEqualTo(vnfId);
+ jujuVnfmInfoMapper.deleteByExample(example);
+ }
+
+ /**
+ * findByVnfId from db
+ * <br/>
+ *
+ * @param vnfId
+ * @return
+ * @since NFVO 0.5
+ */
+ private JujuVnfmInfo findByVnfId(String vnfId){
+ JujuVnfmInfoExample example = new JujuVnfmInfoExample();
+ example.createCriteria().andVnfIdEqualTo(vnfId);
+ List<JujuVnfmInfo> list = jujuVnfmInfoMapper.selectByExample(example);
+ if(CollectionUtils.isNotEmpty(list) && !list.isEmpty()){
+ return list.get(0);
+ }
+ return null;
+ }
+
+ /**
+ * Provide function for terminate VNF
+ * <br/>
+ *
+ * @param vnfId
+ * @param vnfmId
+ * @param vnfObject
+ * @return
+ * @since NFVO 0.5
+ */
+ public JSONObject deleteVnf(String vnfId, String vnfmId, JSONObject vnfObject) {
+ LOG.warn("function=deleteVnf ,msg=enter to delete a vnf, vnfId:{}, vnfmId:{}", vnfId, vnfmId);
+ JSONObject restJson = new JSONObject();
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL);
+ try {
+ String url = SwitchController.vnfmServiceUrl;
+
+ if (StringUtils.isBlank(url)) {
+ JSONObject vnfmObject = VnfmUtil.getVnfmById(vnfmId);
+ if(vnfmObject==null || vnfmObject.isNullObject()) {
+ LOG.error("function=deleteVnf, msg=Unable to get the jujuvnfm info from the 'ESR', vnfmId: {}", vnfmId);
+ return restJson;
+ }
+ url = vnfmObject.getString("url");
+ }
+
+ String vnfInstanceName = "";
+ JujuVnfmInfo jujuInfo = findByVnfId(vnfId);
+ if(jujuInfo != null){
+ vnfInstanceName = jujuInfo.getAppName();
+ }
+ JSONObject params = new JSONObject();
+ params.put(Constant.VNFM_ID, vnfmId);
+ params.put("appName", vnfInstanceName);
+ params.put("vnfId", vnfId);
+
+ Map<String, String> paramsMap = new HashMap<>(6);
+ paramsMap.put("url", url);
+ paramsMap.put(Constant.METHOD_TYPE, Constant.POST);
+ paramsMap.put("path", UrlConstant.REST_JUJU_CLIENT_DESTORY);
+ paramsMap.put(Constant.AUTH_MODE, Constant.AuthenticationMode.ANONYMOUS);
+ RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(paramsMap, params.toString(), null);
+ if(rsp == null) {
+ LOG.error("function=deleteVnf, msg=send create vnf msg to csm get wrong results");
+ return restJson;
+ }
+
+ int statusCode = rsp.getStatus();
+ if(statusCode == Constant.UNREG_SUCCESS) {
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_SUCCESS);
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("jobId", vnfId + "_" + Constant.DELETE);
+ restJson.put("data", resultObj);
+ delJujuVnfmInfo(vnfId);
+ } else {
+ LOG.error("function=removeVnf, msg=send remove vnf msg to csm get wrong status: {}", statusCode);
+ }
+
+ } catch(JSONException e) {
+ LOG.error("function=deleteVnf, msg=JSONException occurs, e={}.", e);
+ }
+ return restJson;
+ }
+
+ /**
+ * Provide function for get VNF
+ * <br/>
+ *
+ * @param vnfId
+ * @param vnfmId
+ * @return
+ * @since NFVO 0.5
+ */
+ public JSONObject getVnf(String vnfId, String vnfmId) {
+ LOG.warn("function=getVnf ,msg=enter to get a vnf, vnfId:{}, vnfmId:{}", vnfId, vnfmId);
+ JSONObject restJson = new JSONObject();
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL);
+ try {
+ String url = SwitchController.vnfmServiceUrl;
+ JSONObject vnfmObject = null;
+ if (StringUtils.isBlank(url)) {
+ // call the ESR to get jujuvnfm server url
+ vnfmObject = VnfmUtil.getVnfmById(vnfmId);
+ if(vnfmObject==null || vnfmObject.isNullObject()) {
+ LOG.error("Unable to get jujuvnfm url info from the 'ESR', vnfmId: {}", vnfmId);
+ return restJson;
+ }
+ url = vnfmObject.getString("url");
+ }
+
+ String appName = "";
+ JujuVnfmInfo jujuInfo = findByVnfId(vnfId);
+ if(jujuInfo != null){
+ appName = jujuInfo.getAppName();
+ }
+ JSONObject params = new JSONObject();
+ params.put(Constant.VNFM_ID, vnfmId);
+ params.put("vnfId", vnfId);
+
+
+ Map<String, String> paramsMap = new HashMap<>(6);
+ paramsMap.put("url", url);
+ paramsMap.put(Constant.METHOD_TYPE, Constant.GET);
+ paramsMap.put("path", String.format(UrlConstant.REST_JUJU_CLIENT_GET,appName));
+ paramsMap.put(Constant.AUTH_MODE, Constant.AuthenticationMode.ANONYMOUS);
+ RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(paramsMap, params.toString(), null);
+ if(rsp == null) {
+ LOG.error("function=getVnf, msg=send create vnf msg to csm get wrong results");
+ return restJson;
+ }
+ JSONObject queryResult = JSONObject.fromObject(rsp.getResponseContent());
+ int statusCode = rsp.getStatus();
+ if(statusCode == Constant.HTTP_OK || statusCode == Constant.HTTP_CREATED) {
+ if(null == (queryResult.get("data"))) {
+ LOG.warn("function=getVnf, msg=query is null {}", queryResult.get("data"));
+ return restJson;
+ }
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_SUCCESS);
+ restJson.put("data", JSONObject.fromObject(queryResult.getString("data")));
+ } else {
+ LOG.error("function=getVnf, msg=send get vnf msg to csm get wrong status: {}", statusCode);
+ }
+ return restJson.getInt(EntityUtils.RESULT_CODE_KEY) == Constant.REST_FAIL ? restJson
+ : getVnfBody(vnfId,appName, vnfmObject);
+
+ } catch(JSONException e) {
+ LOG.error("function=getVnf, msg=JSONException occurs, e={}.", e);
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL);
+ }
+ return restJson;
+ }
+
+ private JSONObject getVnfBody(String vnfId,String appName, JSONObject vnfmObject) {
+ JSONObject vnfInfoJson = new JSONObject();
+ JSONObject basicInfoJson = new JSONObject();
+
+ basicInfoJson.put("vnfInstanceId", vnfId);
+ basicInfoJson.put("vnfInstanceName", appName);
+ basicInfoJson.put("vnfInstanceDescription", "vFW");
+ basicInfoJson.put("vnfdId", vnfmObject == null ? "" : vnfmObject.getString("vnfdId"));
+ basicInfoJson.put("vnfdPackageId", vnfmObject == null ? "" : vnfmObject.getString("vnfPackageId"));
+ basicInfoJson.put("version", vnfmObject == null ? "" : vnfmObject.getString("version"));
+ basicInfoJson.put("vnfProvider", "hw");
+ basicInfoJson.put("vnfType", appName);
+ basicInfoJson.put("vnfStatus", "activie");
+
+ vnfInfoJson.put("vnfInfo", basicInfoJson);
+ vnfInfoJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_SUCCESS);
+ return vnfInfoJson;
+ }
+
+ /**
+ * Provide function for get job
+ * <br/>
+ *
+ * @param jobId
+ * @param vnfmId
+ * @return
+ * @since NFVO 0.5
+ */
+ public JSONObject getJob(String jobId, String vnfmId) {
+ LOG.info("getJob->jobId="+jobId+",vnfmId="+vnfmId);
+ JSONObject jobInfoJson = new JSONObject();
+ JSONObject responseJson = new JSONObject();
+ jobInfoJson.put("jobId",jobId);
+ responseJson.put("progress","100");
+ responseJson.put("status","finished");
+ responseJson.put("errorCode","null");
+ responseJson.put("responseId",(Math.random()*10+1));
+ jobInfoJson.put("responseDescriptor",responseJson);
+ LOG.info("get job response:"+jobInfoJson);
+ return jobInfoJson;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgr.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgr.java
new file mode 100644
index 0000000..434817e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgr.java
@@ -0,0 +1,240 @@
+/*
+ * 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.jujuvnfmadapter.service.process;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.SwitchController;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample;
+import org.openo.nfvo.jujuvnfmadapter.service.mapper.JujuVnfmInfoMapper;
+import org.python.jline.internal.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONException;
+import net.sf.json.JSONObject;
+
+/**
+ * Provide function of resource for VNFM.
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 25, 2016
+ */
+public class VnfResourceMgr {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfResourceMgr.class);
+
+ private JujuVnfmInfoMapper jujuVnfmInfoMapper;
+
+ /**
+ * @return Returns the jujuVnfmInfoMapper.
+ */
+ public JujuVnfmInfoMapper getJujuVnfmInfoMapper() {
+ return jujuVnfmInfoMapper;
+ }
+
+ /**
+ * @param jujuVnfmInfoMapper The jujuVnfmInfoMapper to set.
+ */
+ public void setJujuVnfmInfoMapper(JujuVnfmInfoMapper jujuVnfmInfoMapper) {
+ this.jujuVnfmInfoMapper = jujuVnfmInfoMapper;
+ }
+
+ /**
+ * Provide function of grant resource for VNFM.
+ * <br/>
+ *
+ * @param vnfId
+ * @return
+ * @since NFVO 0.5
+ */
+ public JSONObject grantVnfResource(JSONObject compute, String vnfId) {
+ LOG.warn("function=grantVnfResource, msg=call LCM to grant vnf resource, params: {}", compute);
+ JSONObject resultJson = new JSONObject();
+ resultJson.put("retCode", Constant.REST_FAIL);
+ try {
+ if(SwitchController.isDebugModel()){
+ resultJson.put("retCode", Constant.REST_SUCCESS);
+ resultJson.put("data", "{'mock_result':true}");
+ return resultJson;
+ }
+ JujuVnfmInfo vnfmInfo = findByVnfId(vnfId);
+ String vimId = getVimId(vnfmInfo);
+ JSONObject reqParams = this.buildGrantReq(vimId, vnfId,compute);
+
+ resultJson = VnfmRestfulUtil.sendReqToApp(UrlConstant.RES_VNF, Constant.POST, reqParams);
+ } catch(JSONException e) {
+ LOG.error("function=grantVnfResource, msg=parse params occoured JSONException e={}.", e);
+ resultJson.put("errorMsg", "params parse exception");
+ }
+
+ return resultJson;
+ }
+
+ /**
+ * {
+ "vnfInstanceId": 1,
+ "addResource": [
+ {
+ "resourceDefinitionId": "11111",
+ "resourceTemplate": {
+ "VirtualComputeDescriptor": {
+ "virtualCpu": {
+ "numVirtualCpu": 1
+ },
+ "virtualMemory": {
+ "virtualMemSize": 1//mem in MB
+ }
+ },
+ "VirtualStorageDescriptor": {
+ "typeOfStorage": "",
+ "sizeOfStorage": 111, //disk in GB
+ "swImageDescriptor": ""
+ }
+ },
+ "type": "vdu",
+ "vdu": "vdu_name"
+ }
+ ],
+ "vimId":"",
+ "removeResource": [],
+ "additionalParam": {}
+}
+ *
+ * <br/>
+ *
+ * @return
+ * @since NFVO 0.5
+ */
+ private JSONObject buildGrantReq(String vimId, String vnfInstanceId,JSONObject compute){
+ JSONObject obj = new JSONObject();
+ obj.put("vnfInstanceId", vnfInstanceId);
+ obj.put("vimId", vimId);
+ obj.put("additionalParam", new JSONObject());
+ JSONArray array = new JSONArray();
+ JSONObject resource = new JSONObject();
+ resource.put("resourceDefinitionId", UUID.randomUUID().toString());
+ resource.put("type", "vdu");
+ resource.put("vdu", "vdu_name");//vdu_name?
+ JSONObject resourceTemplate = new JSONObject();
+ JSONObject virtualComputeDescriptor = new JSONObject();
+ JSONObject virtualCpu = new JSONObject();
+ JSONObject virtualMemory = new JSONObject();
+ virtualCpu.put("numVirtualCpu", compute.get("cpu") !=null?compute.get("cpu"):0);
+ virtualMemory.put("virtualMemSize", compute.get("mem") !=null?compute.get("mem"):0);
+ virtualComputeDescriptor.put("virtualCpu", virtualCpu);
+ virtualComputeDescriptor.put("virtualMemory", virtualMemory);
+ JSONObject virtualStorageDescriptor = new JSONObject();
+ virtualStorageDescriptor.put("typeOfStorage", "");
+ virtualStorageDescriptor.put("swImageDescriptor", "");
+ virtualStorageDescriptor.put("sizeOfStorage", compute.get("disk") !=null?compute.get("disk"):0);
+ resourceTemplate.put("VirtualComputeDescriptor", virtualComputeDescriptor);
+ resourceTemplate.put("VirtualStorageDescriptor", virtualStorageDescriptor);
+ resource.put("resourceTemplate", resourceTemplate);
+ array.add(resource);
+ if("addResource".equals(compute.getString("action"))){
+ obj.put("addResource", array);
+ obj.put("removeResource", new JSONArray());
+ }else{
+ obj.put("removeResource", array);
+ obj.put("addResource", new JSONArray());
+ }
+ Log.info("buildGrantReq->result="+obj);
+ return obj;
+ }
+
+ /**
+ * {
+ * “vnfInstanceName”:”vFW”,
+ * “vnfPackageId”:”1”,
+ * “vnfDescriptorId”:”1”,
+ * “vnfInstanceDescription”:”vFW_1”,
+ * “extVirtualLinks”:[
+ * {
+ * ”vlInstanceId”:”1”,
+ * “resourceId”:”1246”,
+ * ” cpdId”:”11111”,
+ * ”vim”:
+ * {
+ * “vimInfoId”:”1”,
+ * “vimid”:”1”,
+ * “interfaceInfo”:{
+ * "vimType":”vim”,
+ * "apiVersion":”v2”,
+ * "protocolType":”http”
+ * }
+ * “accessInfo”:{
+ * "tenant":”tenant_vCPE”,
+ * "username":”vCPE”,
+ * "password":”vCPE_321”
+ * }
+ * “interfaceEndpoint”:”http://10.43.21.105:80/”
+ * }
+ * }
+ * ]
+ * “additionalParam”:{
+ * ……
+ * }
+ * }
+ * <br/>
+ *
+ * @return
+ * @since NFVO 0.5
+ */
+ private String getVimId(JujuVnfmInfo vnfmInfo) {
+ try {
+ if(vnfmInfo != null && StringUtils.isNotBlank(vnfmInfo.getExtend())){
+ JSONObject json = JSONObject.fromObject(vnfmInfo.getExtend());
+ JSONObject extVirtualLinkLink = json.getJSONArray("extVirtualLinks").getJSONObject(0);
+ String vimId = extVirtualLinkLink.getJSONObject("vim").getString("vimid");
+ return vimId;
+ }
+ } catch(Exception e) {
+ LOG.error("vnfmInfo.getExtend() format error!please check it",e);
+ }
+ return null;
+ }
+
+ /**
+ * findByVnfId from db
+ * <br/>
+ *
+ * @param vnfId
+ * @return
+ * @since NFVO 0.5
+ */
+ private JujuVnfmInfo findByVnfId(String vnfId) {
+ JujuVnfmInfoExample example = new JujuVnfmInfoExample();
+ example.createCriteria().andVnfIdEqualTo(vnfId);
+ List<JujuVnfmInfo> list = jujuVnfmInfoMapper.selectByExample(example);
+ if(CollectionUtils.isNotEmpty(list) && !list.isEmpty()) {
+ return list.get(0);
+ }
+ return null;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoa.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoa.java
new file mode 100644
index 0000000..38c12fa
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoa.java
@@ -0,0 +1,193 @@
+/*
+ * 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.jujuvnfmadapter.service.rest;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.FileUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.JujuConfigUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils.ExeRes;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.JujuVnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.AdapterResourceManager;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
+import org.openo.nfvo.jujuvnfmadapter.common.SwitchController;
+import org.openo.nfvo.jujuvnfmadapter.common.VnfmUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 13, 2016
+ */
+@Path("/v1/config")
+@Consumes(MediaType.APPLICATION_JSON)
+@Produces(MediaType.APPLICATION_JSON)
+public class ConfigRoa {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigRoa.class);
+
+ /**
+ * <br/>
+ *
+ * @param context
+ * @param resp
+ * @return
+ * @since NFVO 0.5
+ */
+ @GET
+ @Path("/")
+ public String initUI(@Context HttpServletRequest context, @Context HttpServletResponse resp) {
+ return EntityUtils.toString(new SwitchController(), SwitchController.class);
+ }
+
+ /**
+ * <br/>
+ *
+ * @param type
+ * @param context
+ * @param resp
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @GET
+ @Path("/debug/{type}")
+ public boolean setDebugModel(@PathParam("type") int type, @Context HttpServletRequest context,
+ @Context HttpServletResponse resp) throws ServiceException {
+ if(type == 1) {
+ SwitchController.setDebugModel(true);
+ } else {
+ SwitchController.setDebugModel(false);
+ }
+ LOG.debug("change to debug model:" + SwitchController.isDebugModel());
+ return SwitchController.isDebugModel();
+ }
+
+ /**
+ * <br/>
+ *
+ * @param methodName
+ * @param context
+ * @param resp
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @GET
+ @Path("/mock/{methodName}")
+ public boolean mock(@PathParam("methodName") String methodName, @Context HttpServletRequest context,
+ @Context HttpServletResponse resp) throws ServiceException {
+ if("getVnfmById".equals(methodName)) {
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject json = new JSONObject();
+ json.put("vnfmId", vnfmId);
+ json.put("vnfdId", "testVnfdId");
+ json.put("vnfPackageId", "testPackageId");
+ json.put("version", "1");
+ json.put("url", JujuConfigUtil.getValue("jujuvnfm_server_url"));
+ return json;
+ }
+ };
+ } else if("execute".equals(methodName)) {
+ new MockUp<EntityUtils>() {
+
+ @Mock
+ public ExeRes execute(String dir, List<String> command) {
+ ExeRes er = new ExeRes();
+ String resContent = null;
+ try {
+ resContent = new String(
+ FileUtils.readFile(new File(JujuConfigUtil.getValue("juju_cmd_res_file")), "UTF-8"));
+ } catch(Exception e) {
+ LOG.error("mock fail",e);
+ resContent = "mock fail";
+ }
+ er.setBody(resContent);
+ return er;
+ }
+ };
+ }else if("fetchDownloadUrlFromCatalog".equals(methodName)) {
+ new MockUp<AdapterResourceManager>() {
+ @Mock
+ public String fetchDownloadUrlFromCatalog(String csarId){
+ return JujuConfigUtil.getValue("catalog_download_url");
+ }
+ };
+ }
+ return true;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param methodName
+ * @param context
+ * @param resp
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @GET
+ @Path("/unmock/{methodName}")
+ public boolean unmock(@PathParam("methodName") String methodName, @Context HttpServletRequest context,
+ @Context HttpServletResponse resp) throws ServiceException {
+ if("getVnfmById".equals(methodName)) {
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(
+ String.format(UrlConstant.REST_ESRINFO_GET, vnfmId), JujuVnfmRestfulUtil.GET_TYPE, null);
+ if(rsp == null || rsp.getStatus() != Constant.HTTP_OK) {
+ return null;
+ }
+ LOG.error("funtion=getVnfmById, status={}", rsp.getStatus());
+ return JSONObject.fromObject(rsp.getResponseContent());
+ }
+ };
+ }
+ return true;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoa.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoa.java
new file mode 100644
index 0000000..d6e7569
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoa.java
@@ -0,0 +1,252 @@
+/*
+ * 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.jujuvnfmadapter.service.rest;
+
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.JujuConfigUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.JujuClientManager;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IJujuClientManager;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.process.VnfMgr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 18, 2016
+ */
+@Path("/v1/vnfms")
+@Consumes(MediaType.APPLICATION_JSON)
+@Produces(MediaType.APPLICATION_JSON)
+public class JujuClientRoa {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JujuClientRoa.class);
+
+ private IJujuClientManager jujuClientManager;
+ private VnfMgr vnfMgr;
+
+ /**
+ * @return Returns the jujuClientManager.
+ */
+ public IJujuClientManager getJujuClientManager() {
+ return jujuClientManager;
+ }
+
+ /**
+ * @param jujuClientManager The jujuClientManager to set.
+ */
+ public void setJujuClientManager(IJujuClientManager jujuClientManager) {
+ this.jujuClientManager = jujuClientManager;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public VnfMgr getVnfMgr() {
+ return vnfMgr;
+ }
+
+ /**
+ *
+ * @param vnfMgr
+ */
+ public void setVnfMgr(VnfMgr vnfMgr) {
+ this.vnfMgr = vnfMgr;
+ }
+
+ /**
+ * Set Charm url for juju deployment
+ * <br/>
+ *
+ * @param resp
+ * @param context
+ * parameter : charmUrl
+ * @return "{"charmUrl":"http://dld_url"}
+ * @since NFVO 0.5
+ */
+ @POST
+ @Path("/setCharmUrl")
+ public String setCharmUrl(@Context HttpServletRequest context, @Context HttpServletResponse resp)
+ throws ServiceException {
+ JSONObject result = new JSONObject();
+ result.put("retCode", Constant.REST_FAIL);
+ JSONObject reqJsonObject = StringUtil.getJsonFromContexts(context);
+
+ LOG.debug(reqJsonObject + ":");
+ return result.toString();
+ }
+
+ /**
+ * Get VNF status
+ * parameter: vnfInstanceId
+ * <br/>
+ *
+ * @param modelName
+ * @param resp
+ * @param context
+ * @return Depends on juju's return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @GET
+ @Path("/status")
+ public String getVnfStatus(@QueryParam("modelName") String modelName, @Context HttpServletRequest context,
+ @Context HttpServletResponse resp) throws ServiceException {
+ String appName = processAppName(modelName);
+ JSONObject result = jujuClientManager.getStatus(appName);
+ LOG.debug("status json str:"+result.toString());
+ return result.toString();
+
+
+ }
+
+ /**
+ * Instance VNF to juju-client
+ * <br/>
+ * deployParam: depend on juju require
+ *
+ * @param resp
+ * @param context
+ * @return status: deplay result <br>
+ * the return data must be include "{
+ * app_info:{"vnfId":123344}
+ * }"
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @POST
+ @Path("/deploy")
+ public String deploySerivce(@Context HttpServletRequest context, @Context HttpServletResponse resp)
+ throws ServiceException {
+ JSONObject result = new JSONObject();
+ String msg = null;
+ try {
+ result.put(EntityUtils.RESULT_CODE_KEY, EntityUtils.ExeRes.FAILURE);
+ JSONObject reqJsonObject = StringUtil.getJsonFromContexts(context);
+ LOG.info("deploySerivce request data-->"+reqJsonObject);
+ if(reqJsonObject == null || reqJsonObject.get(Constant.APP_NAME) == null){
+ result.put(EntityUtils.MSG_KEY, "the param 'appName' can't be null");
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return result.toString();
+ }
+ String csarId = (String)reqJsonObject.get("csarId");
+
+ String appName = reqJsonObject.getString(Constant.APP_NAME);
+ appName = processAppName(appName);
+ //1、download the catalog,unzip file and get the charmPath
+ String charmPath = vnfMgr.getCharmPath(csarId);
+ if(StringUtils.isBlank(charmPath)) {
+ charmPath = JujuConfigUtil.getValue("charmPath");
+ }
+ String vnfId = UUID.randomUUID().toString();
+ //2、grant resource
+ boolean grantRes = jujuClientManager.grantResource(charmPath, appName, JujuClientManager.ADDRESOURCE, vnfId);
+ LOG.info("grantResource result:"+grantRes);
+ //3、deploy service
+ if(grantRes){
+ result = jujuClientManager.deploy(charmPath,appName);
+ if(result.getInt(EntityUtils.RESULT_CODE_KEY) == EntityUtils.ExeRes.SUCCESS){
+ resp.setStatus(Constant.HTTP_CREATED);
+ }
+ result.put("vnfId", vnfId);//return vnfId
+ return result.toString();
+ }else{
+ msg = "Grant resource fail:"+vnfId;
+ }
+ } catch(Exception e) {
+ msg = e.getMessage();
+ LOG.error("deploy fail in method deployService",e);
+ }
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ result.put(EntityUtils.MSG_KEY, msg);
+ return result.toString();
+ }
+
+ /**
+ * <br/>
+ * here appName equals modelName
+ * @param resp
+ * @param context
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @POST
+ @Path("/destroy")
+ public String destroySerivce(@Context HttpServletRequest context, @Context HttpServletResponse resp)
+ throws ServiceException {
+ JSONObject result = new JSONObject();
+ result.put(EntityUtils.RESULT_CODE_KEY, EntityUtils.ExeRes.FAILURE);
+ String msg;
+ try {
+ JSONObject reqJsonObject = StringUtil.getJsonFromContexts(context);
+ if(reqJsonObject == null || reqJsonObject.get(Constant.APP_NAME) == null){
+ result.put(EntityUtils.MSG_KEY, "the param 'appName' can't be null");
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return result.toString();
+ }
+ String appName = reqJsonObject.getString(Constant.APP_NAME);
+ appName = processAppName(appName);
+ String vnfId="";
+ if(reqJsonObject.containsKey("vnfId")) {
+ vnfId = reqJsonObject.getString("vnfId");
+ }
+ result = jujuClientManager.destroy(appName);
+ resp.setStatus(Constant.UNREG_SUCCESS);
+ LOG.info("destroy service success!!!"+appName+vnfId);
+ return result.toString();
+ } catch(Exception e) {
+ msg = e.getMessage();
+ LOG.error("destory fail in method destroyService",e);
+
+ }
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ result.put(EntityUtils.MSG_KEY, msg);
+ return result.toString();
+ }
+
+ private static String processAppName(String appName){
+ if(appName != null && appName.indexOf(".yaml") > 0){//remove zte's attach
+ return appName.substring(0,appName.indexOf(".yaml"))+".yaml";
+ }
+ return appName;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/SwaggerRoa.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/SwaggerRoa.java
new file mode 100644
index 0000000..06e461a
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/SwaggerRoa.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.jujuvnfmadapter.service.rest;
+
+import java.io.IOException;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.commons.io.IOUtils;
+
+/**
+ * Swagger API Doc.<br/>
+ *
+ * @author
+ * @version NFVO 0.5 Oct 24, 2016
+ */
+@Path("/v1")
+@Produces({MediaType.APPLICATION_JSON})
+public class SwaggerRoa {
+ /**
+ * API doc.
+ * @param filename
+ * @return
+ * @throws IOException
+ */
+ @GET
+ @Path("/swagger.json")
+ public String apidoc() throws IOException{
+ ClassLoader classLoader = getClass().getClassLoader();
+ return IOUtils.toString(classLoader.getResourceAsStream("swagger.json"));
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoa.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoa.java
new file mode 100644
index 0000000..7510e0e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoa.java
@@ -0,0 +1,102 @@
+/*
+ * 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.jujuvnfmadapter.service.rest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.process.VnfResourceMgr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ * Provide interfaces of resource for juju VNFM to call.
+ * <br/>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 24, 2016
+ */
+@Path("/v1")
+@Consumes(MediaType.APPLICATION_JSON)
+@Produces(MediaType.APPLICATION_JSON)
+public class VnfResourceRoa {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfResourceRoa.class);
+
+ private VnfResourceMgr vnfResourceMgr;
+
+ public void setVnfResourceMgr(VnfResourceMgr vnfResourceMgr) {
+ this.vnfResourceMgr = vnfResourceMgr;
+ }
+
+ /**
+ * Provide function of grant resource.
+ * <br/>
+ *JSONObject compute :
+ * field:(cpu,mem,disk,action(addResource/removeResource))
+ * @param context
+ * @param vnfId
+ * @return
+ * @since NFVO 0.5
+ */
+ @PUT
+ @Path("/instances/{vnfId}/grant")
+ public String grantVnfRes(@Context HttpServletRequest context, @PathParam("vnfId") String vnfId) {
+ LOG.info("function=grantVnfRes, msg=enter to grant vnf resource");
+ JSONObject restJson = new JSONObject();
+ restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL);
+
+ JSONObject compute = StringUtil.getJsonFromContexts(context);
+ if(null == compute) {
+ LOG.error("function=grantVnfRes, msg=param request content can't be null!");
+ restJson.put("data", "param request content can't be null!");
+ return restJson.toString();
+ }
+
+ JSONObject resultObj = vnfResourceMgr.grantVnfResource(compute, vnfId);
+ handleResult(resultObj, restJson);
+
+ return restJson.toString();
+ }
+
+ private void handleResult(JSONObject resultObj, JSONObject restJson) {
+ if(resultObj.getInt("retCode") == Constant.REST_SUCCESS) {
+ restJson.put("retCode", Constant.REST_SUCCESS);
+ restJson.put("data", resultObj.getJSONObject("data"));
+ } else {
+ if(resultObj.containsKey("data")) {
+ String errorMsg = resultObj.getString("data");
+ LOG.error("function=handleResult, msg={}", errorMsg);
+ restJson.put("data", errorMsg);
+ } else {
+ LOG.error("function=handleResult, msg=Vnf Resource dispose fail");
+ restJson.put("data", "Vnf Resource dispose fail");
+ }
+ }
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoa.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoa.java
new file mode 100644
index 0000000..df29ba3
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoa.java
@@ -0,0 +1,256 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.commons.collections.map.UnmodifiableMap;
+import org.apache.commons.lang3.StringUtils;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.SwitchController;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.process.VnfMgr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ * Provide interfaces for instantiate or terminate VNF.
+ * <br/>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 24, 2016
+ */
+@SuppressWarnings("unchecked")
+@Path("/v1")
+@Consumes(MediaType.APPLICATION_JSON)
+@Produces(MediaType.APPLICATION_JSON)
+public class VnfRoa {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfRoa.class);
+
+ private VnfMgr vnfMgr;
+
+ private static Map<String, String> progressItem;
+
+ private static Map<String, String> jobStatusitem;
+
+ static {
+ Map<String, String> map = new HashMap<>();
+ map.put("Building", "50");
+ map.put("Active", "100");
+ map.put("Stopped", "50");
+ map.put("Error", "100");
+ progressItem = UnmodifiableMap.decorate(map);
+
+ map = new HashMap<>();
+ map.put("Building", "processing");
+ map.put("Active", "finished");
+ map.put("Stopped", "processing");
+ map.put("Error", "error");
+ jobStatusitem = UnmodifiableMap.decorate(map);
+ }
+
+ public void setVnfMgr(VnfMgr vnfMgr) {
+ this.vnfMgr = vnfMgr;
+ }
+
+
+ @POST
+ @Path("/vnfminfo")
+ public String setVNFMInfo(@Context HttpServletRequest context, @Context HttpServletResponse resp)
+ throws ServiceException {
+ JSONObject result = new JSONObject();
+ result.put("retCode", Constant.REST_SUCCESS);
+ JSONObject reqJsonObject = StringUtil.getJsonFromContexts(context);
+ String vnfmServiceUrl = reqJsonObject.getString("url");
+ SwitchController.vnfmServiceUrl = vnfmServiceUrl;
+ LOG.info(reqJsonObject + ":setVNFMInfo success!");
+ return result.toString();
+ }
+
+ /**
+ * Provide function for instantiate VNF
+ * <br/>
+ *
+ * @param context
+ * @param resp
+ * @param vnfmId
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @POST
+ @Path("/{vnfmId}/vnfs")
+ public String addVnf(@Context HttpServletRequest context, @Context HttpServletResponse resp,
+ @PathParam("vnfmId") String vnfmId) throws ServiceException {
+ LOG.warn("function=addVnf, msg=enter to add a vnf");
+ JSONObject subJsonObject = StringUtil.getJsonFromContexts(context);
+ LOG.info("request context:"+subJsonObject);
+ JSONObject restJson = new JSONObject();
+
+ if(null == subJsonObject) {
+ LOG.error("function=addVnf, msg=params are insufficient");
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return restJson.toString();
+ }
+
+ restJson = vnfMgr.addVnf(subJsonObject, vnfmId);
+
+ if(restJson.getInt(EntityUtils.RESULT_CODE_KEY) == Constant.REST_FAIL) {
+ LOG.error("function=addVnf, msg=addvnf fail");
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return restJson.toString();
+ }
+
+ return JSONObject.fromObject(restJson.getJSONObject("data")).toString();
+ }
+
+ /**
+ * Provide function for terminate VNF
+ * <br/>
+ *
+ * @param vnfmId
+ * @param resp
+ * @param vnfInstanceId
+ * @param context
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @DELETE
+ @Path("/{vnfmId}/vnfs/{vnfInstanceId}/terminate")
+ public String delVnfDel(@PathParam("vnfmId") String vnfmId, @Context HttpServletResponse resp,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context HttpServletRequest context)
+ throws ServiceException {
+
+ return this.delVnf(vnfmId, resp, vnfInstanceId, context);
+ }
+
+ /**
+ * Provide function for terminate VNF
+ * <br/>
+ *
+ * @param vnfmId
+ * @param resp
+ * @param vnfInstanceId
+ * @param context
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @POST
+ @Path("/{vnfmId}/vnfs/{vnfInstanceId}/terminate")
+ public String delVnf(@PathParam("vnfmId") String vnfmId, @Context HttpServletResponse resp,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context HttpServletRequest context)
+ throws ServiceException {
+ LOG.warn("function=delVnf, msg=enter to delete a vnf: vnfInstanceId: {}, vnfmId: {}", vnfInstanceId, vnfmId);
+ JSONObject vnfObject = StringUtil.getJsonFromContexts(context);
+ LOG.info("request context:"+vnfObject);
+ JSONObject restJson = new JSONObject();
+
+ if(StringUtils.isEmpty(vnfInstanceId) || StringUtils.isEmpty(vnfmId)) {
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return restJson.toString();
+ }
+
+ restJson = vnfMgr.deleteVnf(vnfInstanceId, vnfmId, vnfObject);
+ if(restJson.getInt(EntityUtils.RESULT_CODE_KEY) == Constant.REST_FAIL) {
+ LOG.error("function=delVnf, msg=delVnf fail");
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return restJson.toString();
+ }
+
+ return JSONObject.fromObject(restJson.getJSONObject("data")).toString();
+ }
+
+ /**
+ * Provide function for get VNF
+ * <br/>
+ *
+ * @param vnfmId
+ * @param resp
+ * @param vnfInstanceId
+ * @param context
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @GET
+ @Path("/{vnfmId}/vnfs/{vnfInstanceId}")
+ public String getVnf(@PathParam("vnfmId") String vnfmId, @Context HttpServletResponse resp,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context HttpServletRequest context)
+ throws ServiceException {
+ LOG.warn("function=getVnf, msg=enter to get a vnf: vnfInstanceId: {}, vnfmId: {}", vnfInstanceId, vnfmId);
+ JSONObject restJson = new JSONObject();
+
+ if(StringUtils.isEmpty(vnfInstanceId) || StringUtils.isEmpty(vnfmId)) {
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return restJson.toString();
+ }
+
+ restJson = vnfMgr.getVnf(vnfInstanceId, vnfmId);
+ if(restJson.getInt(EntityUtils.RESULT_CODE_KEY) == Constant.REST_FAIL) {
+ LOG.error("function=getVnf, msg=getVnf fail");
+ resp.setStatus(Constant.HTTP_INNERERROR);
+ return restJson.toString();
+ }
+
+ restJson.remove(EntityUtils.RESULT_CODE_KEY);
+ return restJson.toString();
+ }
+
+ /**
+ * Provide function for get job
+ * <br/>
+ *
+ * @param jobId
+ * @param vnfmId
+ * @param resp
+ * @param responseId
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @GET
+ @Path("/{vnfmId}/jobs/{jobId}")
+ public String getJob(@PathParam("jobId") String jobId, @PathParam("vnfmId") String vnfmId,
+ @Context HttpServletResponse resp, @QueryParam("@responseId") String responseId) throws ServiceException {
+ LOG.warn("function=getJob, msg=enter to get a job: jobId: {}", jobId);
+ JSONObject restJson = new JSONObject();
+ restJson = vnfMgr.getJob(jobId, vnfmId);
+
+ return restJson.toString();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessage.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessage.java
new file mode 100644
index 0000000..3069c11
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessage.java
@@ -0,0 +1,64 @@
+/*
+ * 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.jujuvnfmadapter.service.rest.exceptionmapper;
+
+import org.apache.http.HttpStatus;
+
+/**
+ * Exception response model.<br>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 27, 2016
+ */
+public class ExceptionMessage {
+
+ private String errorCode = "unknown.error";
+
+ private int httpCode = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+
+ private String message;
+
+ @Override
+ public String toString() {
+ return "Error {errorCode=" + this.errorCode + ", httpCode=" + this.httpCode + ", message="
+ + this.message + "}";
+ }
+
+ public String getErrorCode() {
+ return this.errorCode;
+ }
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public int getHttpCode() {
+ return this.httpCode;
+ }
+
+ public void setHttpCode(int httpCode) {
+ this.httpCode = httpCode;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapper.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapper.java
new file mode 100644
index 0000000..908a0f1
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapper.java
@@ -0,0 +1,41 @@
+/*
+ * 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.jujuvnfmadapter.service.rest.exceptionmapper;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * Generic exception response provider.<br>
+ *
+ *
+ * @author
+ * @version NFVO 0.5 Sep 27, 2016
+ */
+@Provider
+public class GenericExceptionMapper implements ExceptionMapper<Exception>{
+
+ @Override
+ public Response toResponse(Exception exception) {
+ ExceptionMessage message = new ExceptionMessage();
+ message.setMessage(exception.getMessage());
+ return Response.status(message.getHttpCode()).type(
+ MediaType.APPLICATION_JSON).entity(message).build();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapper.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapper.java
new file mode 100644
index 0000000..ffddd99
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapper.java
@@ -0,0 +1,45 @@
+/*
+ * 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.jujuvnfmadapter.service.rest.exceptionmapper;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+/**
+ * ServiceException response provider.<br>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 27, 2016
+ */
+@Provider
+public class ServiceExceptionMapper implements ExceptionMapper<ServiceException>{
+
+ @Override
+ public Response toResponse(ServiceException exception) {
+ ExceptionMessage message = new ExceptionMessage();
+ message.setErrorCode(exception.getId());
+ message.setHttpCode(exception.getHttpCode());
+ message.setMessage(exception.getMessage());
+ return Response.status(message.getHttpCode()).
+ type(MediaType.APPLICATION_JSON).entity(message).build();
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/db.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/db.properties
new file mode 100644
index 0000000..8f9dbb4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/db.properties
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+jdbc.username=root
+jdbc.password=rootpass
+jdbc.url=jdbc:mysql://127.0.0.1:3306/jujuvnfmdb
+jdbc.driverClassName=com.mysql.jdbc.Driver \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/juju-config.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/juju-config.properties
new file mode 100644
index 0000000..1141561
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/juju-config.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# 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.
+###############################################################################
+catalog_download_url=http://127.0.0.1:8080/abc.csar
+charmPath=/opt/csar/
+jujuvnfm_server_url=http://127.0.0.1:8080/juju-vnfmadapter-service
+grant_jujuvnfm_url=http://127.0.0.1:8080/juju-vnfmadapter-service
+juju_cmd_res_file=E:/juju/response/result.json
+
+juju_add_model_cmd=
+juju_switch_model_cmd=
+juju_deploy_cmd=
+juju_status_cmd=
+juju_destroy_model=
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/log4j.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/log4j.properties
new file mode 100644
index 0000000..7fc5d67
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/log4j.properties
@@ -0,0 +1,28 @@
+###############################################################################
+# 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.
+###############################################################################
+log4j.rootLogger=INFO,root
+log4j.logger.org.openo.nfvo=DEBUG,stdout
+log4j.appender.root.Append=true
+log4j.appender.root.File=${catalina.base}/logs/jujuvnfmadapterservice.log
+log4j.appender.root.layout.ConversionPattern=%d %-5p [%t][%X{moduleID}][%C %L] %m%n
+log4j.appender.root.layout=org.apache.log4j.PatternLayout
+log4j.appender.root.MaxBackupIndex=50
+log4j.appender.root.MaxFileSize=20MB
+log4j.appender.root=org.apache.log4j.RollingFileAppender
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t][%X{moduleID}][%C %L] %m%n \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/mybatis/mysql/JujuVnfmInfoMapper.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/mybatis/mysql/JujuVnfmInfoMapper.xml
new file mode 100644
index 0000000..39d76b7
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/mybatis/mysql/JujuVnfmInfoMapper.xml
@@ -0,0 +1,382 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+ -->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper
+ namespace="org.openo.nfvo.jujuvnfmadapter.service.mapper.JujuVnfmInfoMapper">
+ <resultMap id="BaseResultMap"
+ type="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo">
+ <id column="ID" property="id" jdbcType="VARCHAR" />
+ <result column="VNFM_ID" property="vnfmId" jdbcType="VARCHAR" />
+ <result column="VNF_ID" property="vnfId" jdbcType="VARCHAR" />
+ <result column="APP_NAME" property="appName" jdbcType="VARCHAR" />
+ <result column="JOB_ID" property="jobId" jdbcType="VARCHAR" />
+ <result column="STATUS" property="status" jdbcType="INTEGER" />
+ <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
+ <result column="MODIFY_TIME" property="modifyTime" jdbcType="TIMESTAMP" />
+ <result column="DELETE_TIME" property="deleteTime" jdbcType="TIMESTAMP" />
+ </resultMap>
+ <resultMap id="ResultMapWithBLOBs"
+ type="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo"
+ extends="BaseResultMap">
+ <result column="EXTEND" property="extend" jdbcType="LONGVARCHAR" />
+ </resultMap>
+ <sql id="Example_Where_Clause">
+ <where>
+ <foreach collection="oredCriteria" item="criteria" separator="or">
+ <if test="criteria.valid">
+ <trim prefix="(" suffix=")" prefixOverrides="and">
+ <foreach collection="criteria.criteria" item="criterion">
+ <choose>
+ <when test="criterion.noValue">
+ and ${criterion.condition}
+ </when>
+ <when test="criterion.singleValue">
+ and ${criterion.condition} #{criterion.value}
+ </when>
+ <when test="criterion.betweenValue">
+ and ${criterion.condition} #{criterion.value} and
+ #{criterion.secondValue}
+ </when>
+ <when test="criterion.listValue">
+ and ${criterion.condition}
+ <foreach collection="criterion.value" item="listItem"
+ open="(" close=")" separator=",">
+ #{listItem}
+ </foreach>
+ </when>
+ </choose>
+ </foreach>
+ </trim>
+ </if>
+ </foreach>
+ </where>
+ </sql>
+ <sql id="Update_By_Example_Where_Clause">
+ <where>
+ <foreach collection="example.oredCriteria" item="criteria"
+ separator="or">
+ <if test="criteria.valid">
+ <trim prefix="(" suffix=")" prefixOverrides="and">
+ <foreach collection="criteria.criteria" item="criterion">
+ <choose>
+ <when test="criterion.noValue">
+ and ${criterion.condition}
+ </when>
+ <when test="criterion.singleValue">
+ and ${criterion.condition} #{criterion.value}
+ </when>
+ <when test="criterion.betweenValue">
+ and ${criterion.condition} #{criterion.value} and
+ #{criterion.secondValue}
+ </when>
+ <when test="criterion.listValue">
+ and ${criterion.condition}
+ <foreach collection="criterion.value" item="listItem"
+ open="(" close=")" separator=",">
+ #{listItem}
+ </foreach>
+ </when>
+ </choose>
+ </foreach>
+ </trim>
+ </if>
+ </foreach>
+ </where>
+ </sql>
+ <sql id="Base_Column_List">
+ ID, VNFM_ID, VNF_ID, APP_NAME, JOB_ID, STATUS, CREATE_TIME, MODIFY_TIME,
+ DELETE_TIME
+ </sql>
+ <sql id="Blob_Column_List">
+ EXTEND
+ </sql>
+ <select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample">
+ select
+ <if test="distinct">
+ distinct
+ </if>
+ <include refid="Base_Column_List" />
+ ,
+ <include refid="Blob_Column_List" />
+ from jujuvnfm
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ <if test="orderByClause != null">
+ order by ${orderByClause}
+ </if>
+ </select>
+ <select id="selectByExample" resultMap="BaseResultMap"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample">
+ select
+ <if test="distinct">
+ distinct
+ </if>
+ <include refid="Base_Column_List" />
+ from jujuvnfm
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ <if test="orderByClause != null">
+ order by ${orderByClause}
+ </if>
+ <if test="limitStart >= 0">
+ limit ${limitStart} , ${limitEnd}
+ </if>
+ </select>
+ <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs"
+ parameterType="java.lang.String">
+ select
+ <include refid="Base_Column_List" />
+ ,
+ <include refid="Blob_Column_List" />
+ from jujuvnfm
+ where ID = #{id,jdbcType=VARCHAR}
+ </select>
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+ delete from jujuvnfm
+ where ID = #{id,jdbcType=VARCHAR}
+ </delete>
+ <delete id="deleteByExample"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample">
+ delete from jujuvnfm
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ </delete>
+ <insert id="insert"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo">
+ insert into jujuvnfm (ID, VNFM_ID, VNF_ID,
+ APP_NAME, JOB_ID, STATUS,
+ CREATE_TIME, MODIFY_TIME, DELETE_TIME,
+ EXTEND)
+ values (#{id,jdbcType=VARCHAR}, #{vnfmId,jdbcType=VARCHAR},
+ #{vnfId,jdbcType=VARCHAR},
+ #{appName,jdbcType=VARCHAR}, #{jobId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
+ #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP},
+ #{deleteTime,jdbcType=TIMESTAMP},
+ #{extend,jdbcType=LONGVARCHAR})
+ </insert>
+ <insert id="insertSelective"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo">
+ insert into jujuvnfm
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ ID,
+ </if>
+ <if test="vnfmId != null">
+ VNFM_ID,
+ </if>
+ <if test="vnfId != null">
+ VNF_ID,
+ </if>
+ <if test="appName != null">
+ APP_NAME,
+ </if>
+ <if test="jobId != null">
+ JOB_ID,
+ </if>
+ <if test="status != null">
+ STATUS,
+ </if>
+ <if test="createTime != null">
+ CREATE_TIME,
+ </if>
+ <if test="modifyTime != null">
+ MODIFY_TIME,
+ </if>
+ <if test="deleteTime != null">
+ DELETE_TIME,
+ </if>
+ <if test="extend != null">
+ EXTEND,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=VARCHAR},
+ </if>
+ <if test="vnfmId != null">
+ #{vnfmId,jdbcType=VARCHAR},
+ </if>
+ <if test="vnfId != null">
+ #{vnfId,jdbcType=VARCHAR},
+ </if>
+ <if test="appName != null">
+ #{appName,jdbcType=VARCHAR},
+ </if>
+ <if test="jobId != null">
+ #{jobId,jdbcType=VARCHAR},
+ </if>
+ <if test="status != null">
+ #{status,jdbcType=INTEGER},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="modifyTime != null">
+ #{modifyTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="deleteTime != null">
+ #{deleteTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="extend != null">
+ #{extend,jdbcType=LONGVARCHAR},
+ </if>
+ </trim>
+ </insert>
+ <select id="countByExample"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample"
+ resultType="java.lang.Integer">
+ select count(*) from jujuvnfm
+ <if test="_parameter != null">
+ <include refid="Example_Where_Clause" />
+ </if>
+ </select>
+ <update id="updateByExampleSelective" parameterType="map">
+ update jujuvnfm
+ <set>
+ <if test="record.id != null">
+ ID = #{record.id,jdbcType=VARCHAR},
+ </if>
+ <if test="record.vnfmId != null">
+ VNFM_ID = #{record.vnfmId,jdbcType=VARCHAR},
+ </if>
+ <if test="record.vnfId != null">
+ VNF_ID = #{record.vnfId,jdbcType=VARCHAR},
+ </if>
+ <if test="record.appName != null">
+ APP_NAME = #{record.appName,jdbcType=VARCHAR},
+ </if>
+ <if test="record.jobId != null">
+ JOB_ID = #{record.jobId,jdbcType=VARCHAR},
+ </if>
+ <if test="record.status != null">
+ STATUS = #{record.status,jdbcType=INTEGER},
+ </if>
+ <if test="record.createTime != null">
+ CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="record.modifyTime != null">
+ MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="record.deleteTime != null">
+ DELETE_TIME = #{record.deleteTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="record.extend != null">
+ EXTEND = #{record.extend,jdbcType=LONGVARCHAR},
+ </if>
+ </set>
+ <if test="_parameter != null">
+ <include refid="Update_By_Example_Where_Clause" />
+ </if>
+ </update>
+ <update id="updateByExampleWithBLOBs" parameterType="map">
+ update jujuvnfm
+ set ID = #{record.id,jdbcType=VARCHAR},
+ VNFM_ID = #{record.vnfmId,jdbcType=VARCHAR},
+ VNF_ID = #{record.vnfId,jdbcType=VARCHAR},
+ APP_NAME = #{record.appName,jdbcType=VARCHAR},
+ JOB_ID = #{record.jobId,jdbcType=VARCHAR},
+ STATUS = #{record.status,jdbcType=INTEGER},
+ CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
+ MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
+ DELETE_TIME = #{record.deleteTime,jdbcType=TIMESTAMP},
+ EXTEND = #{record.extend,jdbcType=LONGVARCHAR}
+ <if test="_parameter != null">
+ <include refid="Update_By_Example_Where_Clause" />
+ </if>
+ </update>
+ <update id="updateByExample" parameterType="map">
+ update jujuvnfm
+ set ID = #{record.id,jdbcType=VARCHAR},
+ VNFM_ID = #{record.vnfmId,jdbcType=VARCHAR},
+ VNF_ID = #{record.vnfId,jdbcType=VARCHAR},
+ APP_NAME = #{record.appName,jdbcType=VARCHAR},
+ JOB_ID = #{record.jobId,jdbcType=VARCHAR},
+ STATUS = #{record.status,jdbcType=INTEGER},
+ CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
+ MODIFY_TIME = #{record.modifyTime,jdbcType=TIMESTAMP},
+ DELETE_TIME = #{record.deleteTime,jdbcType=TIMESTAMP}
+ <if test="_parameter != null">
+ <include refid="Update_By_Example_Where_Clause" />
+ </if>
+ </update>
+ <update id="updateByPrimaryKeySelective"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo">
+ update jujuvnfm
+ <set>
+ <if test="vnfmId != null">
+ VNFM_ID = #{vnfmId,jdbcType=VARCHAR},
+ </if>
+ <if test="vnfId != null">
+ VNF_ID = #{vnfId,jdbcType=VARCHAR},
+ </if>
+ <if test="appName != null">
+ APP_NAME = #{appName,jdbcType=VARCHAR},
+ </if>
+ <if test="jobId != null">
+ JOB_ID = #{jobId,jdbcType=VARCHAR},
+ </if>
+ <if test="status != null">
+ STATUS = #{status,jdbcType=INTEGER},
+ </if>
+ <if test="createTime != null">
+ CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="modifyTime != null">
+ MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="deleteTime != null">
+ DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="extend != null">
+ EXTEND = #{extend,jdbcType=LONGVARCHAR},
+ </if>
+ </set>
+ where ID = #{id,jdbcType=VARCHAR}
+ </update>
+ <update id="updateByPrimaryKeyWithBLOBs"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo">
+ update jujuvnfm
+ set VNFM_ID = #{vnfmId,jdbcType=VARCHAR},
+ VNF_ID = #{vnfId,jdbcType=VARCHAR},
+ APP_NAME = #{appName,jdbcType=VARCHAR},
+ JOB_ID = #{jobId,jdbcType=VARCHAR},
+ STATUS = #{status,jdbcType=INTEGER},
+ CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
+ MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
+ DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
+ EXTEND = #{extend,jdbcType=LONGVARCHAR}
+ where ID = #{id,jdbcType=VARCHAR}
+ </update>
+ <update id="updateByPrimaryKey"
+ parameterType="org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo">
+ update jujuvnfm
+ set VNFM_ID = #{vnfmId,jdbcType=VARCHAR},
+ VNF_ID = #{vnfId,jdbcType=VARCHAR},
+ APP_NAME = #{appName,jdbcType=VARCHAR},
+ JOB_ID = #{jobId,jdbcType=VARCHAR},
+ STATUS = #{status,jdbcType=INTEGER},
+ CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
+ MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
+ DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP}
+ where ID = #{id,jdbcType=VARCHAR}
+ </update>
+</mapper> \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/services.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/services.xml
new file mode 100644
index 0000000..cc7e016
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/services.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+ xmlns:ctx="http://www.springframework.org/schema/context" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/osgi-compendium
+ http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
+ http://cxf.apache.org/jaxrs
+ http://cxf.apache.org/schemas/jaxrs.xsd
+ http://cxf.apache.org/transports/http/configuration
+ http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://www.springframework.org/schema/aop
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
+
+ <context:annotation-config
+ proxy-target-class="true" />
+ <context:component-scan base-package="org.openo.nfvo.jujuvnfmadapter" />
+
+ <!-- these are included in the dependency jar -->
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+ <bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
+
+ <bean id="db" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="location" value="classpath:db.properties"/>
+ </bean>
+
+ <bean id="source"
+ class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+ <property name="driverClassName" value="${jdbc.driverClassName}" />
+ <property name="url" value="${jdbc.url}" />
+ <property name="username" value="${jdbc.username}" />
+ <property name="password" value="${jdbc.password}" />
+ </bean>
+
+ <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
+ <property name="dataSource" ref="source" />
+ <property name="mapperLocations" value="classpath*:mybatis/mysql/*.xml" />
+ </bean>
+
+ <bean id="session" class="org.mybatis.spring.SqlSessionTemplate">
+ <constructor-arg index="0" ref="sessionFactory" />
+ </bean>
+
+
+ <bean id="transactionManager"
+ class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+ <property name="dataSource" ref="source" />
+ </bean>
+ <bean id="jujuVnfmInfoMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
+ <property name="mapperInterface"
+ value="org.openo.nfvo.jujuvnfmadapter.service.mapper.JujuVnfmInfoMapper"/>
+ <property name="sqlSessionFactory" ref="sessionFactory"/>
+ </bean>
+
+
+ <bean id="vnfMgr" class="org.openo.nfvo.jujuvnfmadapter.service.process.VnfMgr">
+ <property name="jujuVnfmInfoMapper" ref="jujuVnfmInfoMapper"/>
+ <property name="resourceManager" ref="resourceManager"/>
+ </bean>
+ <bean id="vnfResourceMgr" class="org.openo.nfvo.jujuvnfmadapter.service.process.VnfResourceMgr">
+ <property name="jujuVnfmInfoMapper" ref="jujuVnfmInfoMapper"/>
+
+ </bean>
+ <bean id="jujuClientManager"
+ class="org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.JujuClientManager"/>
+ <bean id="resourceManager"
+ class="org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.AdapterResourceManager"/>
+
+ <!-- -->
+ <bean id="jujuClientRoa"
+ class="org.openo.nfvo.jujuvnfmadapter.service.rest.JujuClientRoa">
+ <property name="jujuClientManager" ref="jujuClientManager"/>
+ <property name="vnfMgr" ref="vnfMgr"/>
+ </bean>
+ <bean id="vnfRoa" class="org.openo.nfvo.jujuvnfmadapter.service.rest.VnfRoa">
+ <property name="vnfMgr" ref="vnfMgr"/>
+ </bean>
+ <bean id="configRoa" class="org.openo.nfvo.jujuvnfmadapter.service.rest.ConfigRoa"/>
+
+ <bean id="SwaggerRoa" class="org.openo.nfvo.jujuvnfmadapter.service.rest.SwaggerRoa"/>
+ <bean id="vnfResourceRoa" class="org.openo.nfvo.jujuvnfmadapter.service.rest.VnfResourceRoa">
+ <property name="vnfResourceMgr" ref="vnfResourceMgr"/>
+ </bean>
+
+ <jaxrs:server id="restContainer" address="/">
+ <jaxrs:serviceBeans>
+ <ref bean="jujuClientRoa" />
+ <ref bean="vnfRoa" />
+ <ref bean="configRoa" />
+ <ref bean="SwaggerRoa" />
+ <ref bean="vnfResourceRoa"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="jsonProvider" />
+ </jaxrs:providers>
+ </jaxrs:server>
+</beans> \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/svc_register.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/svc_register.xml
new file mode 100644
index 0000000..27e8c27
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/spring/JujuVnfmadapter/svc_register.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+ xmlns:ctx="http://www.springframework.org/schema/context" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/osgi-compendium
+ http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
+ http://cxf.apache.org/jaxrs
+ http://cxf.apache.org/schemas/jaxrs.xsd
+ http://cxf.apache.org/transports/http/configuration
+ http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://www.springframework.org/schema/aop
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
+ <bean class="org.openo.nfvo.jujuvnfmadapter.service.activator.ROAJujuServicePostProcessor"></bean>
+ <bean class="org.openo.nfvo.jujuvnfmadapter.service.api.internalsvc.impl.JujuAdapterMgrService"></bean>
+</beans> \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/swagger.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/swagger.json
new file mode 100644
index 0000000..cfd1307
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/resources/swagger.json
@@ -0,0 +1,608 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "title": "Juju VNFM Driver API",
+ "description": "VNF service provider.",
+ "version": "1.0.0"
+ },
+ "host": "nfvo.openo.org",
+ "schemes": [
+ "https",
+ "http"
+ ],
+ "basePath": "/openoapi",
+ "paths": {
+ "/{vnfmtype}/v1/{vnfmid}/vnfs": {
+ "post": {
+ "summary": "Instantiate VNF",
+ "description": "Add VNF",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "name": "vnfmtype",
+ "in": "path",
+ "description": "vnfm type",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "vnfmid",
+ "in": "path",
+ "description": "vnfm id",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "vnfmid",
+ "description": "Provide required properties of VNF.",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/Vnf"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "VNF Response",
+ "schema": {
+ "$ref": "#/definitions/VnfResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "404": {
+ "description": "VNF Not Found"
+ },
+ "500": {
+ "description": "VNF service failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/{vnfmtype}/v1/{vnfmid}/vnfs/{vnfInstanceId}/terminate": {
+ "post": {
+ "summary": "Instantiate VNF",
+ "description": "Add VNF",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "name": "vnfmtype",
+ "in": "path",
+ "description": "vnfm type",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "vnfmid",
+ "in": "path",
+ "description": "vnfm id",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "vnfInstanceId",
+ "in": "path",
+ "description": "vnfm instance id",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "vnfmTerminate",
+ "description": "Provide required properties of VNF.",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/VnfTerminate"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "VNF Response",
+ "schema": {
+ "$ref": "#/definitions/VnfTerminateResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "404": {
+ "description": "VNF Not Found"
+ },
+ "500": {
+ "description": "VNF service failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/{vnfmtype}/v1/{vnfmid}/vnfs/{vnfInstanceId}": {
+ "get": {
+ "summary": "Query VNF",
+ "description": "Get VNF Details",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "name": "vnfmtype",
+ "in": "path",
+ "description": "vnfm type",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "vnfmid",
+ "in": "path",
+ "description": "vnfm id",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "vnfInstanceId",
+ "in": "path",
+ "description": "vnfm instance id",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "VNF Response",
+ "schema": {
+ "$ref": "#/definitions/VnfInfoResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "404": {
+ "description": "VNF Not Found"
+ },
+ "500": {
+ "description": "VNF service failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/{vnfmtype}/v1/jobs/{jobid}&responseId={responseId}": {
+ "get": {
+ "summary": "Get VNF operational status",
+ "description": "VNF operational status",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "name": "vnfmtype",
+ "in": "path",
+ "description": "vnfm type",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "jobid",
+ "in": "path",
+ "description": "jobid",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "responseId",
+ "in": "path",
+ "description": "vnfm instance id",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "VNF Response",
+ "schema": {
+ "$ref": "#/definitions/VnfStatusResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "404": {
+ "description": "VNF Not Found"
+ },
+ "500": {
+ "description": "VNF service failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "VnfStatusResponse": {
+ "type": "object",
+ "description": "Operational Status Response.",
+ "required": [
+ "jobId",
+ "responseDescriptor",
+ "status",
+ "progress",
+ "statusDescription",
+ "errorCode",
+ "responseId",
+ "responseHistoryList"
+ ],
+ "properties": {
+ "jobId": {
+ "type": "string",
+ "description": "Job ID"
+ },
+ "responseDescriptor": {
+ "type": "string",
+ "description": "Including vnfStatus,statusDescription,errorCode,progress, responseHistoryList, responseId."
+ },
+ "status": {
+ "type": "string",
+ "description": "JOB status started processing finished error"
+ },
+ "progress": {
+ "type": "integer",
+ "description": "Progress (1 - 100)"
+ },
+ "statusDescription": {
+ "type": "string",
+ "description": "Progress Description"
+ },
+ "errorCode": {
+ "type": "integer",
+ "description": "Errorcode"
+ },
+ "responseId": {
+ "type": "integer",
+ "description": "Response Identifier"
+ },
+ "responseHistoryList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/HistoryDetails"
+ }
+ }
+ }
+ },
+ "HistoryDetails": {
+ "type": "object",
+ "description": "InitiateVnfResponse.",
+ "required": [
+ "vnfStatus",
+ "statusDescription",
+ "errorCode",
+ "progress",
+ "responseId"
+ ],
+ "properties": {
+ "vnfStatus": {
+ "type": "string",
+ "description": "Vnf Job Status."
+ },
+ "statusDescription": {
+ "type": "string",
+ "description": "Progress Description."
+ },
+ "errorCode": {
+ "type": "integer",
+ "description": "Error code."
+ },
+ "progress": {
+ "type": "integer",
+ "description": "progress (1-100)."
+ },
+ "responseId": {
+ "type": "integer",
+ "description": "Response Identifier."
+ }
+ }
+ },
+ "VnfResponse": {
+ "type": "object",
+ "description": "InitiateVnfResponse.",
+ "required": [
+ "jobId",
+ "vnfInstanceId"
+ ],
+ "properties": {
+ "jobId": {
+ "type": "string",
+ "description": "Identifier of the VNF lifecycle operation occurrence."
+ },
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "Identifier of the VNF instance."
+ }
+ }
+ },
+ "VnfTerminateResponse": {
+ "type": "object",
+ "description": "TerminateVnfResponse.",
+ "required": [
+ "jobId"
+ ],
+ "properties": {
+ "jobId": {
+ "type": "string",
+ "description": "Identifier of the VNF lifecycle operation occurrence."
+ }
+ }
+ },
+ "VnfInfoResponse": {
+ "type": "object",
+ "description": "The information items about the selected VNF instance(s) that are returned..",
+ "required": [
+ "VnfInfo"
+ ],
+ "properties": {
+ "VnfInfo": {
+ "$ref": "#/definitions/VnfInfo"
+ }
+ }
+ },
+ "VnfInfo": {
+ "type": "object",
+ "description": "The information items about the selected VNF instance(s) that are returned..",
+ "required": [
+ "vnfInstanceId",
+ "vnfInstanceName",
+ "vnfInstanceDescription",
+ "vnfdId",
+ "vnfPackageId",
+ "version",
+ "vnfProvider",
+ "vnfType",
+ "vnfStatus"
+ ],
+ "properties": {
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "VNF instance identifier."
+ },
+ "vnfInstanceName": {
+ "type": "string",
+ "description": "VNF instance name."
+ },
+ "vnfInstanceDescription": {
+ "type": "string",
+ "description": "Human-readable description of the VNF instance."
+ },
+ "vnfdId": {
+ "type": "string",
+ "description": "Identifier of the VNFD on which the VNF instance is based."
+ },
+ "vnfPackageId": {
+ "type": "string",
+ "description": "Identifier of the VNF Package used to manage the lifecycle of the VNF instance."
+ },
+ "version": {
+ "type": "string",
+ "description": "Version of the VNF."
+ },
+ "vnfProvider": {
+ "type": "string",
+ "description": "Name of the person or company providing the VNF."
+ },
+ "vnfType": {
+ "type": "string",
+ "description": "VNF Application Type."
+ },
+ "vnfStatus": {
+ "default": "active",
+ "enum": [
+ "inactive",
+ "active"
+ ],
+ "description": "The instantiation state of the VNF. Possible values:INACTIVE (Vnf is terminated or not instantiated ), ACTIVE (Vnf is instantiated). [instantiationState]."
+ }
+ }
+ },
+ "VnfTerminate": {
+ "type": "object",
+ "description": "Terminate VNF.",
+ "required": [
+ "terminationType",
+ "gracefulTerminationTimeout"
+ ],
+ "properties": {
+ "terminationType": {
+ "default": "forceful",
+ "enum": [
+ "forceful",
+ "graceful"
+ ],
+ "description": "Signals whether forceful or graceful termination is requested.."
+ },
+ "gracefulTerminationTimeout": {
+ "type": "integer",
+ "format": "int32",
+ "description": "The time interval (second) to wait for the VNF to be taken out of service during graceful termination, before shutting down the VNF and releasing the resources.."
+ }
+ }
+ },
+ "Vnf": {
+ "type": "object",
+ "description": "VNF encapsulate an external IP for the given project in a domain. Each property description is provided with 1. required 2. update allowed 3. format. whenever its needs to be mentioned explicitly.",
+ "required": [
+ "vnfInstanceName",
+ "vnfPackageId",
+ "vnfDescriptorId",
+ "flavourId",
+ "vnfInstanceDescription",
+ "extVirtualLink"
+ ],
+ "properties": {
+ "vnfInstanceName": {
+ "type": "string",
+ "description": "Human-readable name of the VNF instance to be created.."
+ },
+ "vnfPackageId": {
+ "type": "string",
+ "description": "VNF packageId."
+ },
+ "vnfDescriptorId": {
+ "type": "string",
+ "description": "Information sufficient to identify the VNF Descriptor which defines the VNF to be created."
+ },
+ "flavourId": {
+ "type": "string",
+ "description": "verify."
+ },
+ "vnfInstanceDescription": {
+ "type": "string",
+ "description": "Human-readable description of the VNF instance to be created."
+ },
+ "extVirtualLink": {
+ "$ref": "#/definitions/ExtVirtualLinkData"
+ }
+ }
+ },
+ "ExtVirtualLinkData": {
+ "type": "object",
+ "description": "References to external virtual links to connect the VNF to.",
+ "required": [
+ "vlInstanceId",
+ "vim",
+ "networkId",
+ "cpdId"
+ ],
+ "properties": {
+ "vlInstanceId": {
+ "type": "string",
+ "description": "Identifier of the VL instance."
+ },
+ "vim": {
+ "$ref": "#/definitions/VimInfo"
+ },
+ "networkId": {
+ "type": "string",
+ "description": "The network UUID of VIM"
+ },
+ "cpdId": {
+ "type": "string",
+ "description": "Identifier of the external CPD in VNFD"
+ }
+ }
+ },
+ "VimInfo": {
+ "type": "object",
+ "description": "Information about the VIM that manages this resource.",
+ "required": [
+ "vimInfoId",
+ "vimId",
+ "interfaceInfo",
+ "accessInfo",
+ "interfaceEndpoint"
+ ],
+ "properties": {
+ "vimInfoId": {
+ "type": "string",
+ "description": "The identifier of this VimInfo instance, for the purpose of referencing it from other information elements."
+ },
+ "vimId": {
+ "type": "string",
+ "description": "The identifier of the VIM.."
+ },
+ "interfaceInfo": {
+ "$ref": "#/definitions/interfaceInfo"
+ },
+ "accessInfo": {
+ "$ref": "#/definitions/accessInfo"
+ },
+ "interfaceEndpoint": {
+ "type": "string",
+ "description": "Information about the interface endpoint. An example is a URL."
+ }
+ }
+ },
+ "interfaceInfo": {
+ "type": "object",
+ "description": "Information about the interface to the VIM, including VIM provider type, API version, and protocol type..",
+ "required": [
+ "vimType",
+ "apiVersion",
+ "protocolType"
+ ],
+ "properties": {
+ "vimType": {
+ "type": "string",
+ "description": "vim"
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "api version"
+ },
+ "protocolType": {
+ "type": "string",
+ "description": "Type of the protocol"
+ }
+ }
+ },
+ "accessInfo": {
+ "type": "object",
+ "description": "Authentication credentials for accessing the VIM. Examples may include those to support different authentication schemes, e.g., OAuth, Token, etc..",
+ "required": [
+ "tenant",
+ "username",
+ "password"
+ ],
+ "properties": {
+ "tenant": {
+ "type": "string",
+ "description": "Tenant Name of tenant"
+ },
+ "username": {
+ "type": "string",
+ "description": "Username for login"
+ },
+ "password": {
+ "type": "string",
+ "description": "Password of login user"
+ }
+ }
+ },
+ "Error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/webapp/WEB-INF/web.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..95bce6b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/openoapi/jujuvnfm/*</url-pattern>
+ </servlet-mapping>
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>WEB-INF/classes/spring/JujuVnfmadapter/*.xml
+ </param-value>
+ </context-param>
+
+ <session-config>
+ <session-timeout>10000000</session-timeout>
+ </session-config>
+
+ <display-name>juju-vnfmadapter-service</display-name>
+
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+</web-app> \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallbackTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallbackTest.java
new file mode 100644
index 0000000..ea01d2b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/AsyncCallbackTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import org.apache.log4j.Logger;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.service.rest.fullstack.JujuClientRoaTest;
+
+public class AsyncCallbackTest {
+ Logger logger = Logger.getLogger(JujuClientRoaTest.class);
+
+ AsyncCallback Async;
+ RestfulResponse response = new RestfulResponse();
+
+ @Before
+ public void setUp() {
+ Async = new AsyncCallback();
+
+ }
+
+ @Test
+ public void testhandleExcepion() {
+
+ logger.warn("function=callback, msg=status={}, content={}.");
+ Async.callback(response);
+ Async.handleExcepion(null);
+
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtilTest.java
new file mode 100644
index 0000000..28350b4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/CryptUtilTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+
+public class CryptUtilTest {
+
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = CryptUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+ @Test
+ public void testdeCryptenCrypt(){
+ String pwd ="admin";
+ String c=CryptUtil.deCrypt(pwd);
+ String c1=CryptUtil.enCrypt(pwd);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManagerTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManagerTest.java
new file mode 100644
index 0000000..d4eee79
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/DownloadCsarManagerTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2017, 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+
+public class DownloadCsarManagerTest {
+ DownloadCsarManager mgr;
+ @Test
+ public void test() {
+ String url="";
+ String filepath="";
+ mgr.download(url);
+ mgr.download(url, filepath);
+ mgr.getRandomFileName();
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = DownloadCsarManager.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtilsTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtilsTest.java
new file mode 100644
index 0000000..0fed60d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/EntityUtilsTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils.ExeRes;
+
+import net.sf.json.JSONObject;
+
+public class EntityUtilsTest {
+
+ @Test
+ public void formatCommandTest(){
+ List<String> command = new ArrayList<>();
+ command.add("test");
+ String result = EntityUtils.formatCommand(command);
+ assertTrue(result.contains("test"));
+ }
+ @Test
+ public void formatCommandTestNull(){
+ List<String> command = null;
+ String result = EntityUtils.formatCommand(command);
+ assertTrue(result.equals(""));
+ }
+ @Test
+ public void executeTest(){
+ ExeRes res = EntityUtils.execute("test", "test","test2");
+ assertNotNull(res);
+ }
+ @Test(expected = Exception.class)
+ public void toEntity() throws Exception{
+ JSONObject jsonObject = new JSONObject();
+ HashMap map = EntityUtils.toEntity(jsonObject, HashMap.class);
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = EntityUtils.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtil.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtil.java
new file mode 100644
index 0000000..6e03e32
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtil.java
@@ -0,0 +1,50 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class FileUtil {
+
+ public static String ReadFile(String path) {
+ File file = new File(path);
+ BufferedReader reader = null;
+ String laststr = "";
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ String tempString = null;
+ while((tempString = reader.readLine()) != null) {
+ laststr = laststr + tempString;
+ }
+ reader.close();
+ } catch(IOException e) {
+ e.printStackTrace();
+ } finally {
+ if(reader != null) {
+ try {
+ reader.close();
+ } catch(IOException e1) {
+ }
+ }
+ }
+ return laststr;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtilsTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtilsTest.java
new file mode 100644
index 0000000..d41824c
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/FileUtilsTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class FileUtilsTest {
+
+ FileUtils fileUtils;
+ @Before
+ public void setUp(){
+ fileUtils.getAppAbsoluteUrl();
+ }
+
+ @Test
+ public void testWriteFile() throws Exception {
+ ClassLoader classLoader = getClass().getClassLoader();
+ File file = new File(classLoader.getResource("").getFile());
+ String filePath = "";
+ byte[] bytes = new byte[] {40,50};
+ int b = fileUtils.writeFile(bytes, filePath);
+ assertNotNull(b);
+ }
+ @Test
+ @Ignore
+ public void testReadFile() throws Exception {
+ ClassLoader classLoader = getClass().getClassLoader();
+ File f = new File(classLoader.getResource("").getFile());
+ System.out.println(f.isAbsolute());
+ String charsetName = "UTF-8";
+ byte[] b = fileUtils.readFile(f, charsetName);
+ assertNotNull(b);
+ }
+ @Test
+ public void testListFiles() throws Exception {
+ String file = ".";
+ File f = new File(file);
+ List<File> files = fileUtils.listFiles(f);
+ assertNotNull(files);
+
+ }
+ @Test
+ public void testMkDirs() throws Exception {
+ File resourcesDirectory = new File("src/test/resources");
+ String path = resourcesDirectory.getAbsolutePath()+"/TestDir";
+ resourcesDirectory.getAbsolutePath();
+ fileUtils.mkDirs(path);
+ }
+ @Test
+ public void testDelFiles() throws Exception {
+ File resourcesDirectory = new File("src/test/resources/TestDir/Test.txt");
+ assertTrue(fileUtils.delFiles(resourcesDirectory.getAbsolutePath()));
+ }
+ @Test
+ public void testgetFiles() throws Exception {
+ File resourcesDirectory = new File("src/test/resources");
+ List<File> files = fileUtils.getFiles(resourcesDirectory.getAbsolutePath());
+ assertNotNull(files);
+ }
+ @Test
+ public void testCopy() throws Exception {
+ File oldfile = new File("");
+ File newfile = new File("");
+ fileUtils.copy(oldfile.getAbsolutePath(), newfile.getAbsolutePath(), true);
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = FileUtils.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtilTest.java
new file mode 100644
index 0000000..1175fe8
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/JujuConfigUtilTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+
+public class JujuConfigUtilTest {
+
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = JujuConfigUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtilsTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtilsTest.java
new file mode 100644
index 0000000..61b84d5
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/LocalComandUtilsTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.LocalComandUtils.ExeRes;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class LocalComandUtilsTest {
+
+ @Test
+ public void testformatCommand(){
+ new MockUp<LocalComandUtils>(){
+ @Mock
+ public String formatCommand(List<String> command){
+ return null;
+ }
+ };
+ List<String> command =new ArrayList<String> ();
+ command.add("test1");
+ command.add("test2");
+ String s=LocalComandUtils.formatCommand(command);
+
+
+ }
+
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = LocalComandUtils.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtilTest.java
new file mode 100644
index 0000000..ce6e755
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/ResourceUtilTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+
+
+public class ResourceUtilTest {
+
+ @Test
+ public void testformatCommand(){
+ String key="key";
+ String r=ResourceUtil.getMessage(key);
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = ResourceUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolderTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolderTest.java
new file mode 100644
index 0000000..34c8c72
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/SpringContextHolderTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+
+
+public class SpringContextHolderTest {
+
+ SpringContextHolder contextholder;
+ @Before
+ public void setUp() {
+ contextholder = new SpringContextHolder();
+ }
+ @Autowired
+ ApplicationContext context;
+ @Test
+ public void test() {
+ SpringContextHolder ctx=new SpringContextHolder();
+ ctx.setApplicationContext(context);
+ contextholder.cleanApplicationContext();
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtilTest.java
new file mode 100644
index 0000000..ea95a8a
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/StringUtilTest.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import net.sf.json.JSONArray;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+
+public class StringUtilTest {
+
+ @Test
+ public void testIsValidString() {
+ boolean result = StringUtil.isValidString("abc");
+ assertTrue(result);
+ }
+
+ @Test
+ public void testIsValidString1() {
+ boolean result = StringUtil.isValidString(" abc ");
+ assertTrue(result);
+ }
+
+ @Test
+ public void testIsValidString2() {
+ boolean result = StringUtil.isValidString(" ");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsValidString3() {
+ boolean result = StringUtil.isValidString("");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsValidString4() {
+ boolean result = StringUtil.isValidString(null);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsValidUrl() {
+ boolean result = StringUtil.isValidUrl("https://127.0.0.1:31943");
+ assertTrue(result);
+ }
+
+ @Test
+ public void testIsValidUrl1() {
+ boolean result = StringUtil.isValidUrl("http://255.250.255.1:31943");
+ assertTrue(result);
+ }
+
+ @Test
+ public void testIsValidUrl2() {
+ boolean result = StringUtil.isValidUrl("http:");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsValidUrl3() {
+ boolean result = StringUtil.isValidUrl("http://255.250");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsValidUrl4() {
+ boolean result = StringUtil.isValidUrl("");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsValidAnyString() {
+ boolean result = StringUtil.isValidAnyString("abc", "aaa", "bbb");
+ assertTrue(result);
+ }
+
+ @Test
+ public void testIsValidAnyString1() {
+ boolean result = StringUtil.isValidAnyString("abc", "", "bbb");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testTransSitesToArray() {
+ String sites = "Beijing&Shanghai";
+ JSONArray result = StringUtil.transSitesToArray(sites);
+
+ JSONArray siteArray = new JSONArray();
+ siteArray.add("Beijing");
+ siteArray.add("Shanghai");
+ assertEquals(siteArray, result);
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = StringUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/TestPojo.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/TestPojo.java
new file mode 100644
index 0000000..04c3bcc
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/TestPojo.java
@@ -0,0 +1,47 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class TestPojo {
+ String name;
+ String id;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Test
+ public void test(){
+ assertTrue(true);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtilTest.java
new file mode 100644
index 0000000..c821cbf
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/UnCompressUtilTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.common;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class UnCompressUtilTest {
+
+ UnCompressUtil util;
+
+ FileInputStream fis;
+
+ @Before
+ public void setUp(){
+ util = new UnCompressUtil();
+
+ }
+
+ @Test
+
+ public void unCompressGzipTest() {
+ String zipfileName = "";
+ String outputDirectory = "";
+ List<String> fileNames = new ArrayList<String>();
+ //fileNames.add("test1");
+ util.unCompressGzip(zipfileName, outputDirectory, fileNames);
+ }
+
+ @Test
+
+ public void unCompressZipTest() {
+ String zipfileName = "";
+ String outputDirectory = "";
+ List<String> fileNames = new ArrayList<String>();
+ util.unCompressZip(zipfileName, outputDirectory, fileNames);
+ }
+
+
+ @Test
+
+ public void unCompressTarXZTest() {
+ String zipfileName = "";
+ String outputDirectory = "";
+ List<String> fileNames = new ArrayList<String>();
+ util.unCompressTarXZ(zipfileName, outputDirectory, fileNames);
+ }
+
+ @Test
+
+ public void unCompressTest() {
+ String zipfileName = "";
+ String outputDirectory = "src//test//resources";
+ List<String> fileNames = new ArrayList<String>();
+ util.unCompress(zipfileName, outputDirectory, fileNames);
+ }
+
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtilTest.java
new file mode 100644
index 0000000..38aa3b9
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VNFJsonUtilTest.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import net.sf.json.JSONObject;
+import net.sf.json.JsonConfig;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.VNFJsonUtil;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.codehaus.jackson.map.type.TypeFactory;
+import org.codehaus.jackson.type.TypeReference;
+public class VNFJsonUtilTest {
+
+ @Test
+ public void testGetJsonFieldStr() {
+ JSONObject VNFJsonObj = new JSONObject();
+ VNFJsonObj.put("name", "testName");
+ String result = VNFJsonUtil.getJsonFieldStr(VNFJsonObj, "name");
+ assertEquals("testName", result);
+ }
+
+ @Test
+ public void testGetJsonFieldStrByNull() {
+ String result = VNFJsonUtil.getJsonFieldStr(null, "name");
+ assertEquals("", result);
+ }
+
+ @Test
+ public void testGetJsonFieldStrByFieldNameNull() {
+ JSONObject VNFJsonObj = new JSONObject();
+ VNFJsonObj.put("names", "testName");
+ String result = VNFJsonUtil.getJsonFieldStr(VNFJsonObj, "name");
+ assertEquals("", result);
+ }
+
+ @Test
+ public void testGetJsonFieldStrByNameNull() {
+ JSONObject VNFJsonObj = new JSONObject();
+ VNFJsonObj.put("name", "null");
+ String result = VNFJsonUtil.getJsonFieldStr(VNFJsonObj, "name");
+ assertEquals("", result);
+ }
+
+ @Test
+ public void testGetJsonFieldInt() {
+ JSONObject VNFJsonObj = new JSONObject();
+ VNFJsonObj.put("name", 5);
+ Integer result = VNFJsonUtil.getJsonFieldInt(VNFJsonObj, "name");
+ assertEquals((Integer)5, result);
+ }
+
+ @Test
+ public void testGetJsonFieldIntByNull() {
+ Integer result = VNFJsonUtil.getJsonFieldInt(null, "name");
+ assertEquals((Integer)0, result);
+ }
+
+ @Test
+ public void testGetJsonFieldIntByNameNull() {
+ JSONObject VNFJsonObj = new JSONObject();
+ VNFJsonObj.put("name", 5);
+ Integer result = VNFJsonUtil.getJsonFieldInt(VNFJsonObj, "names");
+ assertEquals((Integer)0, result);
+ }
+
+ @Test
+ public void testGetJsonFieldLong() {
+ JSONObject VNFJsonObj = new JSONObject();
+ VNFJsonObj.put("name", 5L);
+ Long result = VNFJsonUtil.getJsonFieldLong(VNFJsonObj, "name");
+ assertEquals((Long)5L, result);
+ }
+
+ @Test
+ public void testGetJsonFieldLongByNull() {
+ Long result = VNFJsonUtil.getJsonFieldLong(null, "name");
+ assertEquals((Long)0L, result);
+ }
+
+ @Test
+ public void testGetJsonFieldLongByNameNull() {
+ JSONObject VNFJsonObj = new JSONObject();
+ VNFJsonObj.put("name", 5L);
+ Long result = VNFJsonUtil.getJsonFieldLong(VNFJsonObj, "names");
+ assertEquals((Long)0L, result);
+ }
+
+ @Test
+ public void testParseErrorInfo() {
+ String errorInfo = "{\"error\":{\"message\":\"errorMessage\"}}";
+ String result = VNFJsonUtil.parseErrorInfo(errorInfo);
+ assertEquals("errorMessage", result);
+ }
+
+ @Test
+ public void testParseErrorInfoByNull() {
+ String result = VNFJsonUtil.parseErrorInfo(null);
+ assertEquals("System Error!", result);
+ }
+
+ @Test
+ public void testParseErrorInfoByEmpty() {
+ String errorInfo = "";
+ String result = VNFJsonUtil.parseErrorInfo(errorInfo);
+ assertEquals("System Error!", result);
+ }
+
+ @Test
+ public void testParseErrorInfoByNoError() {
+ String errorInfo = "{\"errors\":{\"message\":\"errorMessage\"}}";
+ String result = VNFJsonUtil.parseErrorInfo(errorInfo);
+ assertEquals("System Error!", result);
+ }
+
+ @Test
+ public void testParseErrorInfoByNoMessage() {
+ String errorInfo = "{\"error\":{\"messages\":\"errorMessage\"}}";
+ String result = VNFJsonUtil.parseErrorInfo(errorInfo);
+ assertEquals("System Error!", result);
+ }
+
+ @Test
+ public void testObjectToJsonStr() {
+ String data = "{\"vnf1\":{\"id\":\"id\"}}";
+ String result = VNFJsonUtil.objectToJsonStr(data);
+ assertEquals(data, result);
+ }
+
+ @Test
+ public void testObjectToJson() {
+ String data = "{\"vnf1\":{\"id\":\"id\"}}";
+ JSONObject result = VNFJsonUtil.objectToJson(data);
+ assertEquals(JSONObject.fromObject(data), result);
+ }
+ @Test
+ public void marshalTest() throws IOException{
+ net.sf.json.JSON json = new JSONObject();
+ String res = VNFJsonUtil.marshal(json);
+ assertTrue(res.equals("{}"));
+ }
+
+ @Test
+ public void marshalTestException() throws IOException{
+ String str="test";
+ String res = VNFJsonUtil.marshal(str);
+ assertTrue(res != null);
+ }
+
+ @Test
+ public void VNFJsonToListsTest(){
+ List<TestPojo> pojoList = VNFJsonUtil.vnfJsonToLists("[{\"name\":\"test\",\"id\":\"123\"}]",TestPojo.class);
+ assertTrue(pojoList.size()==1);
+ }
+
+ @Test
+ public void VNFJsonToListTest(){
+ List<TestPojo> pojoList = VNFJsonUtil.vnfJsonToList("[{\"name\":\"test\",\"id\":\"123\"}]", TestPojo.class, "test");
+ assertTrue(pojoList.size()==1);
+ }
+
+ @Test
+ public void VNFJsonToObjectsTest(){
+ TestPojo pojo = VNFJsonUtil.vnfJsonToObjects("{\"name\":\"test\",\"id\":\"123\"}", TestPojo.class);
+ assertTrue("test".equals(pojo.getName()) && "123".equals(pojo.getId()));
+ }
+
+ @Test(expected = Exception.class)
+ public void VNFJsonToObjectsTestException(){
+ JsonConfig VNFJsonConfig = new JsonConfig();
+ TestPojo pojo = VNFJsonUtil.vnfJsonToObjects("{\"id\":\"123\",\"name\":\"test\"}", VNFJsonConfig);
+ }
+
+ @Test
+ public void objectToJsonTest(){
+ JsonConfig VNFJsonConfig = new JsonConfig();
+ TestPojo pojo = new TestPojo();
+ pojo.setName("test");
+ pojo.setId("123");
+ String res = VNFJsonUtil.objectToJson(pojo, VNFJsonConfig);
+ assertTrue("{\"id\":\"123\",\"name\":\"test\"}".equals(res));
+ }
+
+ @Test
+ public void objectToJsonTest2(){
+ TestPojo pojo = new TestPojo();
+ pojo.setName("test");
+ pojo.setId("123");
+ String res = VNFJsonUtil.objectToJson(pojo, "");
+ assertTrue("{\"id\":\"123\",\"name\":\"test\"}".equals(res));
+ }
+
+ @Test
+ public void listToJsonTest(){
+ List<TestPojo> pojoList = new ArrayList<TestPojo>();
+ TestPojo pojo = new TestPojo();
+ pojo.setName("test");
+ pojo.setId("123");
+ pojoList.add(pojo);
+ String res = VNFJsonUtil.listToJson(pojoList);
+ assertTrue("[{\"id\":\"123\",\"name\":\"test\"}]".equals(res));
+ }
+
+ @Test
+ public void listToJsonTest2(){
+ List<TestPojo> pojoList = new ArrayList<TestPojo>();
+ TestPojo pojo = new TestPojo();
+ pojo.setName("test");
+ pojo.setId("123");
+ pojoList.add(pojo);
+ String res = VNFJsonUtil.listToJson(pojoList,"");
+ assertTrue("[{\"id\":\"123\",\"name\":\"test\"}]".equals(res));
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = VNFJsonUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtilTest.java
new file mode 100644
index 0000000..414218b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/VnfmUtilTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.jujuvnfmadapter.common;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+public class VnfmUtilTest {
+
+ @Test
+ public void getVnfmByIdTestNull(){
+ JSONObject resp = VnfmUtil.getVnfmById("vnfmId");
+ assertNull(resp);
+ }
+ @Test
+ public void getVnfmByIdTest(){
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(String url, String methodType, String params) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(200);
+ JSONObject json = new JSONObject();
+ json.put("id", "1234");
+ resp.setResponseJson(json.toString());
+ return resp;
+ }
+ };
+ JSONObject resp = VnfmUtil.getVnfmById("vnfmId");
+ assertNotNull(resp);
+ }
+ @Test
+ public void getVnfmByIdTest2(){
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(String url, String methodType, String params) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(500);
+ return resp;
+ }
+ };
+ JSONObject resp = VnfmUtil.getVnfmById("vnfmId");
+ assertNull(resp);
+ }
+ @Test
+ public void getVnfmIdByIpNullResp(){
+ String resp = VnfmUtil.getVnfmIdByIp("1.1.1.1");
+ assertEquals(resp,"");
+ }
+ @Test
+ public void getVnfmIdByIpInternalError(){
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(String url, String methodType, String params) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(500);
+ return resp;
+ }
+ };
+ String resp = VnfmUtil.getVnfmIdByIp("1.1.1.1");
+ assertEquals(resp,"");
+ }
+ @Test
+ public void getVnfmIdByIp(){
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(String url, String methodType, String params) {
+ RestfulResponse resp = new RestfulResponse();
+ JSONArray jsonArray = new JSONArray();
+ JSONObject jsonobj = new JSONObject();
+ jsonobj.put("url", "1.1.1.1");
+ jsonobj.put("vnfmId", "1111");
+ jsonArray.add(jsonobj);
+ resp.setResponseJson(jsonArray.toString());
+ resp.setStatus(200);
+ return resp;
+ }
+ };
+ String resp = VnfmUtil.getVnfmIdByIp("1.1.1.1");
+ assertEquals(resp,"1111");
+ }
+
+ @Test
+ public void getVnfmIdByIpInvalidIP(){
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(String url, String methodType, String params) {
+ RestfulResponse resp = new RestfulResponse();
+ JSONArray jsonArray = new JSONArray();
+ JSONObject jsonobj = new JSONObject();
+ jsonobj.put("url", "1.1.1.1");
+ jsonobj.put("vnfmId", "1111");
+ jsonArray.add(jsonobj);
+ resp.setResponseJson(jsonArray.toString());
+ resp.setStatus(200);
+ return resp;
+ }
+ };
+ String resp = VnfmUtil.getVnfmIdByIp("1.1.1.2");
+ assertEquals(resp,"");
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtilTest.java
new file mode 100644
index 0000000..193961a
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/YamlUtilTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 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.jujuvnfmadapter.common;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.yaml.snakeyaml.Yaml;
+
+import net.sf.json.JSON;
+
+public class YamlUtilTest {
+ YamlUtil yaml;
+
+ @Before
+ public void setUp() {
+ yaml = new YamlUtil();
+
+ }
+
+ @Test
+ public void test() throws ServiceException {
+ String yamlName = "src/test/resources/test.yaml";
+
+ JSON json=yaml.yamlToJson(yamlName);
+
+ String S=yaml.loadYaml(yamlName);
+ Yaml yaml = new Yaml();
+ File file =new File(yamlName);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelpTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelpTest.java
new file mode 100644
index 0000000..93d715b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestHelpTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+import org.openo.baseservice.roa.util.restclient.Restful;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.HttpRestHelp;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 10, 2016
+ */
+public class HttpRestHelpTest {
+
+ @Test
+ public void testGetRestInstance() {
+ Restful rest = HttpRestHelp.getRestInstance(null, null, false);
+ assertNotNull(rest);
+ }
+
+ @Test
+ public void testGetRestInstance1() {
+ HttpRestHelp.getRestInstance(null, null, false);
+ Restful rest = HttpRestHelp.getRestInstance(null, null, false);
+ assertNotNull(rest);
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = HttpRestHelp.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelpTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelpTest.java
new file mode 100644
index 0000000..4167c7b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/HttpRestfulHelpTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.common.servicetoken;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+import org.openo.baseservice.roa.util.restclient.Restful;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.HttpRestfulHelp;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 10, 2016
+ */
+public class HttpRestfulHelpTest {
+
+ @Test
+ public void testGetRestInstance() {
+ Restful rest = HttpRestfulHelp.getRestInstance(null, null);
+ assertNotNull(rest);
+ }
+
+ @Test
+ public void testGetRestInstance1() {
+ HttpRestfulHelp.getRestInstance(null, null);
+ Restful rest = HttpRestfulHelp.getRestInstance(null, null);
+ assertNotNull(rest);
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = HttpRestfulHelp.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtilTest.java
new file mode 100644
index 0000000..0c34643
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/JujuVnfmRestfulUtilTest.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.common.servicetoken;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+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.nfvo.jujuvnfmadapter.common.servicetoken.VNFRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 10, 2016
+ */
+public class JujuVnfmRestfulUtilTest {
+
+
+ @Test
+ public void testGetRemoteResponseByVnfmInfoNull() {
+ RestfulResponse result = JujuVnfmRestfulUtil.getRemoteResponse(new HashMap(), null);
+ assertEquals(null, result);
+ }
+
+ @Test
+ public void testGetRemoteResponseByPost() {
+ Map testMap = new HashMap();
+ testMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ testMap.put("methodType","post");
+ RestfulResponse result = JujuVnfmRestfulUtil.getRemoteResponse(testMap, "");
+
+ assertEquals(null, result);
+ }
+
+ @Test
+ public void testGetRemoteResponseByVnfmInfo() {
+ Map testMap = new HashMap();
+ testMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ testMap.put("methodType","get");
+ RestfulResponse result = JujuVnfmRestfulUtil.getRemoteResponse(testMap, "");
+
+ assertEquals(null, result);
+ }
+
+ @Test
+ public void testGetRemoteResponseByVnfmInfoPut() {
+ Map testMap = new HashMap();
+ testMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ testMap.put("methodType","put");
+ RestfulResponse result = JujuVnfmRestfulUtil.getRemoteResponse(testMap, "");
+
+ assertEquals(null, result);
+ }
+
+ @Test
+ public void testGetRemoteResponseByVnfmInfoDelete() {
+ Map testMap = new HashMap();
+ testMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ testMap.put("methodType","delete");
+ RestfulResponse result = JujuVnfmRestfulUtil.getRemoteResponse(testMap, "");
+
+ assertEquals(null, result);
+ }
+
+ @Test
+ public void getVimResponseContentGetInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, Object> result = JujuVnfmRestfulUtil.getVimResponseContent("http://127.0.0.1:8080", restParametes, null, "put");
+ assertTrue(result.isEmpty());
+ }
+ @Test
+ public void getVimResponseContentAddInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, Object> result = JujuVnfmRestfulUtil.getVimResponseContent("http://127.0.0.1:8080", restParametes, null, "add");
+ assertTrue(result.isEmpty());
+ }
+
+ @Test
+ public void getVimResponseContentPutInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, Object> result = JujuVnfmRestfulUtil.getVimResponseContent("http://127.0.0.1:8080", restParametes, null, "put");
+ assertTrue(result.isEmpty());
+ }
+ @Test
+ public void getVimResponseContentDeleteInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, Object> result = JujuVnfmRestfulUtil.getVimResponseContent("http://127.0.0.1:8080", restParametes, null, "delete");
+ assertTrue(result.isEmpty());
+ }
+
+ @Test
+ public void getVimResponseContentPatchInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ Map<String, Object> result = JujuVnfmRestfulUtil.getVimResponseContent("http://127.0.0.1:8080", restParametes, null, "patch");
+ assertTrue(result.isEmpty());
+ }
+
+ @Test
+ public void testGetResultToVnfmByVnfmInfoErrorMsg() {
+ JSONObject vnfmInfo = new JSONObject();
+ vnfmInfo.put("retCode", Constant.REST_FAIL);
+ vnfmInfo.put("msg", "ErrorMsg");
+ JSONObject result = VNFRestfulUtil.getResultToVnfm(vnfmInfo, "vnfmId");
+
+ JSONObject retJson = new JSONObject();
+ retJson.put("retCode", Constant.REST_FAIL);
+ retJson.put("data", "ErrorMsg");
+ assertEquals(retJson, result);
+ }
+
+ @Test
+ public void testGetResultToVnfmByVnfmInfoError() {
+ JSONObject vnfmInfo = new JSONObject();
+ vnfmInfo.put("retCode", Constant.REST_FAIL);
+ JSONObject result = VNFRestfulUtil.getResultToVnfm(vnfmInfo, "vnfmId");
+
+ JSONObject retJson = new JSONObject();
+ retJson.put("retCode", Constant.REST_FAIL);
+ assertEquals(retJson, result);
+ }
+
+ @Test
+ public void vimRestfulResponseTestGetInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ RestfulResponse resp = JujuVnfmRestfulUtil.vimRestfulResponse("http://127.0.0.1:8080", restParametes, null, "get");
+ assertTrue(resp == null);
+ }
+ @Test
+ public void vimRestfulResponseTestAddInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ RestfulResponse resp = JujuVnfmRestfulUtil.vimRestfulResponse("http://127.0.0.1:8080", restParametes, null, "add");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void vimRestfulResponseTestPutInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ RestfulResponse resp = JujuVnfmRestfulUtil.vimRestfulResponse("http://127.0.0.1:8080", restParametes, null, "put");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void vimRestfulResponseTestDeleteInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ RestfulResponse resp = JujuVnfmRestfulUtil.vimRestfulResponse("http://127.0.0.1:8080", restParametes, null, "delete");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void vimRestfulResponseTestPatchInvalid(){
+ RestfulParametes restParametes = new RestfulParametes();
+ RestfulResponse resp = JujuVnfmRestfulUtil.vimRestfulResponse("http://127.0.0.1:8080", restParametes, null, "patch");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponseTestGetInvalid(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("methodType","get");
+ RestfulResponse resp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test", false);
+ assertNull(resp);
+
+ }
+
+ @Test
+ public void getRemoteResponseTestGetHttpsInvalid(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("methodType","get");
+ RestfulResponse resp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test", true);
+ assertNull(resp);
+
+ }
+
+ @Test
+ public void getRemoteResponseTestPostInvalid(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("methodType","post");
+ RestfulResponse resp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test", false);
+ assertNull(resp);
+
+ }
+
+ @Test
+ public void getRemoteResponseTestPutInvalid(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("methodType","put");
+ RestfulResponse resp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test", false);
+ assertNull(resp);
+
+ }
+
+ @Test
+ public void getRemoteResponseTestDeleteInvalid(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("methodType","delete");
+ RestfulResponse resp = JujuVnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test", false);
+ assertNull(resp);
+
+ }
+ @Test
+ public void generateParametesMapTest(){
+ Map<String, String> paramsMap = JujuVnfmRestfulUtil.generateParametesMap("http://localhost:8080", "get", "openoapi/test", "test");
+ assertTrue("http://localhost:8080".equals(paramsMap.get("url")) && "get".equals(paramsMap.get("methodType"))
+ && "openoapi/test".equals(paramsMap.get("path")) && "test".equals(paramsMap.get("authMode")));
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = JujuVnfmRestfulUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfoTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfoTest.java
new file mode 100644
index 0000000..23ed850
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFAuthConfigInfoTest.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.jujuvnfmadapter.common.servicetoken;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VNFAuthConfigInfo;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 10, 2016
+ */
+public class VNFAuthConfigInfoTest {
+
+ @Test
+ public void testGetDomain() {
+ VNFAuthConfigInfo authConfig = VNFAuthConfigInfo.getInstance();
+ authConfig.setDomain("vnfDomain");
+ assertEquals("vnfDomain", authConfig.getDomain());
+ }
+
+ @Test
+ public void testGetResourceDomain() {
+ VNFAuthConfigInfo authConfig = VNFAuthConfigInfo.getInstance();
+ authConfig.setResourceDomain("vnfResourceDomain");
+ assertEquals("vnfResourceDomain", authConfig.getResourceDomain());
+ }
+
+ @Test
+ public void testGetDefaultDomain() {
+ VNFAuthConfigInfo authConfig = VNFAuthConfigInfo.getInstance();
+ authConfig.setDefaultDomain("defaultDomain");
+ assertEquals("defaultDomain", authConfig.getDefaultDomain());
+ }
+
+ @Test
+ public void testGetUserName() {
+ VNFAuthConfigInfo authConfig = VNFAuthConfigInfo.getInstance();
+ authConfig.setUserName("vnfuserName");
+ assertEquals("vnfuserName", authConfig.getUserName());
+ }
+
+ @Test
+ public void testGetEncryptedPW() {
+ VNFAuthConfigInfo authConfig = VNFAuthConfigInfo.getInstance();
+ authConfig.setEncryptedPW("vnfencryptedPW");
+ assertEquals("vnfencryptedPW", authConfig.getEncryptedPW());
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtilTest.java
new file mode 100644
index 0000000..37c6c0b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VNFRestfulUtilTest.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.common.servicetoken;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 10, 2016
+ */
+public class VNFRestfulUtilTest {
+
+ @Test
+ public void testGetRestResByDefaultByNull() {
+ RestfulResponse result = VNFRestfulUtil.getRestResByDefault("path", "methodNames", new JSONObject());
+ assertNull(result);
+ }
+
+ @Test
+ public void testGetRestResByDefaultByGet() {
+ RestfulResponse result = VNFRestfulUtil.getRestResByDefault("path", "get", new JSONObject());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testGetRestResByDefaultByPut() {
+ RestfulResponse result = VNFRestfulUtil.getRestResByDefault("path", "put", new JSONObject());
+ assertNotNull(result);
+ }
+
+ /*@Test
+ public void testSendReqToApp() {
+ new MockUp<VNFRestfulUtil>() {
+
+ @Mock
+ public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+ RestfulResponse restfulResponse = new RestfulResponse();
+ restfulResponse.setStatus(Constant.HTTP_OK);
+ String responseString = "{\"retCode\":1,\"data\":\"success\"}";
+ restfulResponse.setResponseJson(responseString);
+ return restfulResponse;
+ }
+ };
+ JSONObject result = VNFRestfulUtil.sendReqToApp("path", "put", new JSONObject());
+ assertEquals(Constant.REST_SUCCESS, result.get("retCode"));
+ }*/
+
+ /*@Test(expected = ExceptionInInitializerError.class)
+ public void testSendReqToAppByErrorMsg() {
+ new MockUp<VNFRestfulUtil>() {
+
+ @Mock
+ public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+ RestfulResponse restfulResponse = new RestfulResponse();
+ restfulResponse.setStatus(Constant.HTTP_OK);
+ String responseString = "{\"retCode\":-1,\"data\":\"fail\",\"msg\":\"fail\"}";
+ restfulResponse.setResponseJson(responseString);
+ return restfulResponse;
+ }
+ };
+ JSONObject result = VNFRestfulUtil.sendReqToApp("path", "put", new JSONObject());
+ assertEquals(Constant.REST_FAIL, result.get("retCode"));
+ }*/
+
+ /*@Test
+ public void testSendReqToAppByError() {
+ new MockUp<VNFRestfulUtil>() {
+
+ @Mock
+ public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+ RestfulResponse restfulResponse = new RestfulResponse();
+ restfulResponse.setStatus(Constant.HTTP_OK);
+ String responseString = "{\"retCode\":-1,\"data\":\"fail\"}";
+ restfulResponse.setResponseJson(responseString);
+ return restfulResponse;
+ }
+ };
+ JSONObject result = VNFRestfulUtil.sendReqToApp("path", "put", new JSONObject());
+ assertEquals(Constant.REST_FAIL, result.get("retCode"));
+ }*/
+
+ @Test
+ public void testSendReqToAppByFail() {
+ JSONObject result = VNFRestfulUtil.sendReqToApp("path", "put", new JSONObject());
+ assertEquals(Constant.REST_FAIL, result.get("retCode"));
+ }
+
+ @Test
+ public void testSendReqToAppByVnfmInfoPut() {
+ JSONObject paraJson = new JSONObject();
+ JSONObject vnfmObj = new JSONObject();
+ vnfmObj.put("id", "id");
+ paraJson.put("vnfmInfo", vnfmObj);
+ JSONObject result = VNFRestfulUtil.sendReqToApp("path", "put", paraJson);
+ assertEquals(Constant.REST_FAIL, result.get("retCode"));
+ }
+
+ @Test
+ public void testGenerateParamsMap() {
+ Map<String, String> result = VNFRestfulUtil.generateParamsMap("url", "methodType", "path");
+ Map<String, String> paramsMap = new HashMap<String, String>(6);
+ paramsMap.put("url", "url");
+ paramsMap.put("methodType", "methodType");
+ paramsMap.put("path", "path");
+ paramsMap.put("authMode", "Certificate");
+ assertEquals(paramsMap, result);
+ }
+
+ @Test
+ public void testGenerateParamsMap2() {
+ Map<String, String> result = VNFRestfulUtil.generateParamsMap("url", "methodType", "path", "authMode");
+ Map<String, String> paramsMap = new HashMap<String, String>(6);
+ paramsMap.put("url", "url");
+ paramsMap.put("methodType", "methodType");
+ paramsMap.put("path", "path");
+ paramsMap.put("authMode", "authMode");
+ assertEquals(paramsMap, result);
+ }
+
+ @Test
+ public void testGetResultToVnfmByVnfmInfoNull() {
+ JSONObject result = VNFRestfulUtil.getResultToVnfm(null, null);
+
+ JSONObject retJson = new JSONObject();
+ retJson.put("retCode", Constant.REST_FAIL);
+ retJson.put("data", "get null result");
+ assertEquals(retJson, result);
+ }
+
+ @Test
+ public void testGetResultToVnfmByVnfmInfoErrorMsg() {
+ JSONObject vnfmInfo = new JSONObject();
+ vnfmInfo.put("retCode", Constant.REST_FAIL);
+ vnfmInfo.put("msg", "ErrorMsg");
+ JSONObject result = VNFRestfulUtil.getResultToVnfm(vnfmInfo, "vnfmId");
+
+ JSONObject retJson = new JSONObject();
+ retJson.put("retCode", Constant.REST_FAIL);
+ retJson.put("data", "ErrorMsg");
+ assertEquals(retJson, result);
+ }
+
+ @Test
+ public void testGetResultToVnfmByVnfmInfoError() {
+ JSONObject vnfmInfo = new JSONObject();
+ vnfmInfo.put("retCode", Constant.REST_FAIL);
+ JSONObject result = VNFRestfulUtil.getResultToVnfm(vnfmInfo, "vnfmId");
+
+ JSONObject retJson = new JSONObject();
+ retJson.put("retCode", Constant.REST_FAIL);
+ assertEquals(retJson, result);
+ }
+ @Test
+ public void getRemoteResponseTestInvalidGet(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("url", "/openoapi/test");
+ paramsMap.put("methodType","get");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VNFRestfulUtil.getRemoteResponse(paramsMap, null, "test123", true);
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponseTestInvalidPut(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("url", "/openoapi/test");
+ paramsMap.put("methodType","put");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VNFRestfulUtil.getRemoteResponse(paramsMap, null, "test123", true);
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponseTestInvalidPost(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("url", "/openoapi/test");
+ paramsMap.put("methodType","post");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VNFRestfulUtil.getRemoteResponse(paramsMap, null, "test123", true);
+ assertTrue(resp == null);
+ }
+ @Test
+ public void getRemoteResponseTestInvalidDelete(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("url", "/openoapi/test");
+ paramsMap.put("methodType","delete");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VNFRestfulUtil.getRemoteResponse(paramsMap, null, "test123", true);
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponseTestFalseNfvoApp(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "http://localhost:8080");
+ paramsMap.put("url", "/openoapi/test");
+ paramsMap.put("methodType","delete");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VNFRestfulUtil.getRemoteResponse(paramsMap, null, "test123", false);
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void sentEvtByRestTest(){
+ VNFRestfulUtil.sentEvtByRest("http://localhost:8080", "get", null);
+ assertTrue(true);
+ }
+ @Test
+ public void sentEvtByRestTest2(){
+ JSONObject bodyParam = new JSONObject();
+ VNFRestfulUtil.sentEvtByRest("http://localhost:8080", "get",bodyParam);
+ assertTrue(true);
+ }
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = VNFRestfulUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtilTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtilTest.java
new file mode 100644
index 0000000..f0123ed
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/VnfmRestfulUtilTest.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.common.servicetoken;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class VnfmRestfulUtilTest {
+
+ @Test
+ public void testGetRestResByDefaultByNull() {
+ RestfulResponse result = VnfmRestfulUtil.getRestResByDefault("path", "methodNames", new JSONObject());
+ assertNull(result);
+ }
+ @Test
+ public void testGetRestResByDefaultByGet() {
+ RestfulResponse result = VnfmRestfulUtil.getRestResByDefault("path", "get", new JSONObject());
+ assertNotNull(result);
+ }
+
+ @Test
+ public void testGetRestResByDefaultByPut() {
+ RestfulResponse result = VnfmRestfulUtil.getRestResByDefault("path", "put", new JSONObject());
+ assertNotNull(result);
+ }
+
+ ////
+ @Test
+ public void testSendReqToAppByFail() {
+ JSONObject result = VnfmRestfulUtil.sendReqToApp("path", "put", new JSONObject());
+ assertEquals(Constant.REST_FAIL, result.get("retCode"));
+ }
+
+ @Test
+ public void testSendReqToAppByVnfmInfoPut() {
+ JSONObject paraJson = new JSONObject();
+ JSONObject vnfmObj = new JSONObject();
+ vnfmObj.put("id", "id");
+ paraJson.put("vnfmInfo", vnfmObj);
+ JSONObject result = VnfmRestfulUtil.sendReqToApp("path", "put", paraJson);
+ assertEquals(Constant.REST_FAIL, result.get("retCode"));
+ }
+
+ @Test
+ public void testSendReqToAppByVnfmInfoPutNormal() {
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(200);
+ JSONObject obj = new JSONObject();
+ obj.put("retCode", 1);
+ obj.put("data", new JSONObject());
+ resp.setResponseJson(obj.toString());
+ return resp;
+ }
+ };
+ JSONObject paraJson = new JSONObject();
+ JSONObject vnfmObj = new JSONObject();
+ vnfmObj.put("id", "id");
+ JSONObject result = VnfmRestfulUtil.sendReqToApp("path", "put", paraJson);
+ assertEquals(Constant.REST_SUCCESS, result.get("retCode"));
+ }
+ @Test
+ public void testSendReqToAppByVnfmInfoPutNormal2() {
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(200);
+ JSONObject obj = new JSONObject();
+ obj.put("retCode", -1);
+ obj.put("data", new JSONObject());
+ resp.setResponseJson(obj.toString());
+ return resp;
+ }
+ };
+ JSONObject paraJson = new JSONObject();
+ JSONObject vnfmObj = new JSONObject();
+ vnfmObj.put("id", "id");
+ JSONObject result = VnfmRestfulUtil.sendReqToApp("path", "put", paraJson);
+ assertEquals(Constant.REST_FAIL, result.get("retCode"));
+ }
+
+ @Test
+ public void testGenerateParamsMap() {
+ Map<String, String> result = VnfmRestfulUtil.generateParamsMap("url", "methodType", "path","auth");
+ Map<String, String> paramsMap = new HashMap<String, String>(6);
+ paramsMap.put("url", "url");
+ paramsMap.put("methodType", "methodType");
+ paramsMap.put("path", "path");
+ paramsMap.put("authMode", "auth");
+ assertEquals(paramsMap, result);
+ }
+ @Test
+ public void getRemoteResponseTestInvalidGet(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "/test/abc");
+ paramsMap.put("url", "http://localhost:8080");
+ paramsMap.put("methodType","get");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test123");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponseTestInvalidPut(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "/test/abc");
+ paramsMap.put("url", "http://localhost:8080");
+ paramsMap.put("methodType","put");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test123");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponseTestInvalidPost(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "/openoapi/test");
+ paramsMap.put("url", "http://localhost:8080");
+ paramsMap.put("methodType","post");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test123");
+ assertTrue(resp == null);
+ }
+ @Test
+ public void getRemoteResponseTestInvalidDelete(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "/openoapi/test");
+ paramsMap.put("url", "http://localhost:8080");
+ paramsMap.put("methodType","delete");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test123");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponse2TestInvalidGet(){
+ String url = "http://localhost:8080";
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(url, "get", "test123");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponse2TestInvalidPut(){
+ String url = "http://localhost:8080";
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(url, "put", "test123");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponse2TestInvalidPost(){
+ String url = "http://localhost:8080";
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(url, "post", "test123");
+ assertTrue(resp == null);
+ }
+ @Test
+ public void getRemoteResponse2TestInvalidDelete(){
+
+ String url = "http://localhost:8080";
+
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(url, "delete", "test123");
+ assertTrue(resp == null);
+ }
+
+ @Test
+ public void getRemoteResponseTestFalseNfvoApp(){
+ Map<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("path", "/openoapi/test");
+ paramsMap.put("url", "http://localhost:8080");
+ paramsMap.put("methodType","delete");
+ paramsMap.put("authMode","test");
+ RestfulResponse resp = VnfmRestfulUtil.getRemoteResponse(paramsMap, null, "test123");
+ assertTrue(resp == null);
+ }
+
+ /* @Test
+ public void sentEvtByRestTest(){
+ VnfmRestfulUtil.sentEvtByRest("http://localhost:8080", "get", null);
+ assertTrue(true);
+ }
+ @Test
+ public void sentEvtByRestTest2(){
+ JSONObject bodyParam = new JSONObject();
+ VnfmRestfulUtil.sentEvtByRest("http://localhost:8080", "get",bodyParam);
+ assertTrue(true);
+ }*/
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = VnfmRestfulUtil.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokensTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokensTest.java
new file mode 100644
index 0000000..f033984
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/AccessTokensTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken.module;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import net.sf.json.JSONObject;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.module.AccessTokens;
+
+public class AccessTokensTest {
+
+ @Test
+ public void testVimAccessTokens() {
+ AccessTokens accessTokens = new AccessTokens("accessToken", 123);
+ assertEquals("accessToken", accessTokens.getAccessToken());
+ assertEquals(123, accessTokens.getExpire());
+ }
+
+ @Test
+ public void testAccessTokens1() {
+ AccessTokens accessTokens = new AccessTokens("accessToken", null, null);
+ assertEquals("accessToken", accessTokens.getAccessToken());
+ assertEquals(0, accessTokens.getExpire());
+ assertEquals(0, accessTokens.getCreateTime());
+ }
+
+ @Test
+ public void testAccessTokens2() {
+ Integer vimExpire = (Integer)123;
+ Long createTime = (Long)1L;
+ AccessTokens accessTokens = new AccessTokens("accessToken", vimExpire, createTime);
+ assertEquals("accessToken", accessTokens.getAccessToken());
+ assertEquals(123, accessTokens.getExpire());
+ assertEquals(1L, accessTokens.getCreateTime());
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testVimAccessTokens3() {
+ AccessTokens accessTokens = new AccessTokens();
+ }
+
+ @Test
+ public void testSetVimAccessToken() {
+ AccessTokens accessTokens = new AccessTokens("accessToken", 123);
+ accessTokens.setAccessToken("anotherToken");
+ assertEquals("anotherToken", accessTokens.getAccessToken());
+ }
+
+ @Test
+ public void testValidExpire() {
+ AccessTokens accessTokens = new AccessTokens("accessToken", 0);
+ assertTrue(accessTokens.valid());
+ }
+
+ @Test
+ public void testValidExpire1() {
+ AccessTokens accessTokens = new AccessTokens("accessToken", 123);
+ assertTrue(accessTokens.valid());
+ }
+
+ @Test
+ public void testValidExpire2() {
+ AccessTokens accessTokens = new AccessTokens("accessToken", 123, 1L);
+ assertFalse(accessTokens.valid());
+ }
+
+ @Test
+ public void testToString() {
+ AccessTokens accessTokens = new AccessTokens("accessToken", 123, 1L);
+ assertEquals("{accessToken','expire': '123','createTime': '1'}", accessTokens.toString());
+ }
+
+ @Test
+ public void testToEntity() {
+ String data = "{'accessToken': 'accessToken','expire': '123','createTime': '1'}";
+ JSONObject jsonObject = JSONObject.fromObject(data);
+ AccessTokens accessTokens = new AccessTokens("accessToken", 123, 1L);
+ assertEquals(accessTokens.toString(), AccessTokens.toEntity(jsonObject).toString());
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/ServiceTokenHelpTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/ServiceTokenHelpTest.java
new file mode 100644
index 0000000..afb0f91
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/common/servicetoken/module/ServiceTokenHelpTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.jujuvnfmadapter.common.servicetoken.module;
+
+import org.junit.Test;
+
+public class ServiceTokenHelpTest {
+
+ @Test
+ public void testCreateServiceToken() {
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessorTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessorTest.java
new file mode 100644
index 0000000..ad379ae
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/activator/ROAJujuServicePostProcessorTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.activator;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ROAJujuServicePostProcessorTest {
+ ROAJujuServicePostProcessor postprocessor=new ROAJujuServicePostProcessor();
+
+ @Test
+ public void test() {
+ Object bean ="IJujuAdapterMgrService";
+ String name="";
+ postprocessor.postProcessAfterInitialization(bean, name);
+ postprocessor.postProcessBeforeDestruction(bean, name);
+ postprocessor.postProcessBeforeInitialization(bean, name);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java
new file mode 100644
index 0000000..d4e6eba
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java
@@ -0,0 +1,212 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.impl;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.HttpRest;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class AdapterResourceManagerTest {
+
+ private AdapterResourceManager adapterResManager;
+
+ private JSONObject jsonObj;
+
+ /*
+ * @Test public void testGetJujuVnfmInfo() throws Exception { Map paramsMap
+ * = new HashMap(); JSONObject resultObj = new JSONObject();
+ * resultObj.put("reason", "RestfulResponse is null.");
+ * resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+ *
+ * paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ * paramsMap.put("methodType","get");
+ *
+ * new MockUp<JujuVnfmRestfulUtil>(){
+ *
+ * @Mock public RestfulResponse getRemoteResponse(Map paramsMap,String str)
+ * { return null; } }; adapterResManager = new AdapterResourceManager();
+ * jsonObj = adapterResManager.getJujuVnfmInfo(paramsMap);
+ * assertEquals(resultObj,jsonObj); }
+ */
+
+ /*
+ * @Test public void testGetVnfdInfo() throws Exception { Map paramsMap =
+ * new HashMap(); JSONObject resultObj = new JSONObject();
+ * resultObj.put("reason", "RestfulResponse is null.");
+ * resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+ *
+ * paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ * paramsMap.put("methodType","get");
+ *
+ * new MockUp<JujuVnfmRestfulUtil>(){
+ *
+ * @Mock public RestfulResponse getRemoteResponse(Map paramsMap,String str)
+ * { return null; } }; adapterResManager = new AdapterResourceManager();
+ * jsonObj = adapterResManager.getJujuVnfmInfo(paramsMap);
+ * assertEquals(resultObj,jsonObj); }
+ */
+
+ @Test
+ public void getJujuVnfmInfoTest() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse get(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(200);
+ return rsp;
+ }
+ };
+ new MockUp<JSONObject>() {
+ @Mock
+ public JSONObject fromObject(Object object) {
+ JSONObject json = new JSONObject();
+ return json;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+
+ paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ paramsMap.put("methodType", "get");
+ adapterResManager = new AdapterResourceManager();
+ jsonObj = adapterResManager.getJujuVnfmInfo(paramsMap);
+ assertTrue(jsonObj != null);
+ }
+
+ @Test
+ public void getJujuVnfmInfoTest1() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse get(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(504);
+ return rsp;
+ }
+ };
+ new MockUp<JSONObject>() {
+ @Mock
+ public JSONObject fromObject(Object object) {
+ JSONObject json = new JSONObject();
+ return json;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+
+ paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ paramsMap.put("methodType", "get");
+ adapterResManager = new AdapterResourceManager();
+ jsonObj = adapterResManager.getJujuVnfmInfo(paramsMap);
+ assertTrue(jsonObj != null);
+ }
+
+ @Test
+ public void getJujuVnfmInfoTestFalse() {
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+
+ paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ paramsMap.put("methodType", "get");
+ adapterResManager = new AdapterResourceManager();
+ jsonObj = adapterResManager.getJujuVnfmInfo(null);
+ assertTrue(jsonObj.get("reason").equals("RestfulResponse is null."));
+ }
+
+ @Test
+ public void getVnfdInfoTest() {
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+
+ paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ paramsMap.put("methodType", "get");
+ adapterResManager = new AdapterResourceManager();
+// jsonObj = adapterResManager.getVnfdInfo("1111");
+// assertTrue(jsonObj.get("reason").equals("RestfulResponse is null."));
+ }
+
+ @Test
+ public void getVnfdInfoTest1() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse get(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(200);
+ return rsp;
+ }
+ };
+ new MockUp<JSONObject>() {
+ @Mock
+ public JSONObject fromObject(Object object) {
+ JSONObject json = new JSONObject();
+ return json;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+
+ paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ paramsMap.put("methodType", "get");
+ adapterResManager = new AdapterResourceManager();
+// jsonObj = adapterResManager.getVnfdInfo("1111");
+// assertTrue(jsonObj != null);
+ }
+
+ @Test
+ public void getVnfdInfoTest2() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse get(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(504);
+ return rsp;
+ }
+ };
+
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+ resultObj.put("reason", "RestfulResponse is null.");
+ resultObj.put("retCode", Constant.ERROR_STATUS_CODE);
+
+ paramsMap.put("url", "/openoapi/extsys/v1/vnfms/11111");
+ paramsMap.put("methodType", "get");
+ adapterResManager = new AdapterResourceManager();
+// jsonObj = adapterResManager.getVnfdInfo("1111");
+// assertTrue(jsonObj != null);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManagerTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManagerTest.java
new file mode 100644
index 0000000..5814a18
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuAdapter2MSBManagerTest.java
@@ -0,0 +1,267 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.impl;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.HttpRest;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.JujuVnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class JujuAdapter2MSBManagerTest {
+
+ private JujuAdapter2MSBManager adapter2MSBManager;
+
+ private JSONObject jsonObj;
+
+ @Test
+ public void registerJujuAdapterTest() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(200);
+ return rsp;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.registerJujuAdapter(paramsMap, resultObj);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void registerJujuAdapterTest2() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(500);
+ return rsp;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.registerJujuAdapter(paramsMap, resultObj);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void registerJujuAdapterTest3() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(415);
+ return rsp;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.registerJujuAdapter(paramsMap, resultObj);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void registerJujuAdapterTest4() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(201);
+ return rsp;
+ }
+ };
+ new MockUp<JSONObject>() {
+ @Mock
+ public JSONObject fromObject(Object object) {
+ JSONObject json = new JSONObject();
+ return json;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.registerJujuAdapter(paramsMap, resultObj);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void registerJujuAdapterTest1() {
+ Map<String, String> paramsMap = new HashMap<>();
+ JSONObject resultObj = new JSONObject();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.registerJujuAdapter(null, resultObj);
+ assertTrue(resp.get("reason").equals("RestfulResponse is null."));
+ }
+
+ @Test
+ public void unregisterJujuAdapterTest() {
+ Map<String, String> paramsMap = new HashMap<>();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.unregisterJujuAdapter(paramsMap);
+ assertTrue(resp.get("reason").equals("RestfulResponse is null."));
+ }
+
+ @Test
+ public void unregisterJujuAdapterTest1() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(204);
+ return rsp;
+ }
+ };
+ new MockUp<JSONObject>() {
+ @Mock
+ public JSONObject fromObject(Object object) {
+ JSONObject json = new JSONObject();
+ return json;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.unregisterJujuAdapter(paramsMap);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void unregisterJujuAdapterTest2() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(404);
+ return rsp;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.unregisterJujuAdapter(paramsMap);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void unregisterJujuAdapterTest3() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(415);
+ return rsp;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.unregisterJujuAdapter(paramsMap);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void unregisterJujuAdapterTest4() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(500);
+ return rsp;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.unregisterJujuAdapter(paramsMap);
+ assertTrue(resp != null);
+ }
+
+ @Test
+ public void unregisterJujuAdapterTest5() {
+ new MockUp<HttpRest>() {
+ @Mock
+ RestfulResponse post(String arg0, RestfulParametes arg1) throws ServiceException {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(200);
+ return rsp;
+ }
+ };
+ Map<String, String> paramsMap = new HashMap<>();
+
+ paramsMap.put("url", "/openoapi/microservices/v1/services");
+ paramsMap.put("methodType", "post");
+
+ JujuAdapter2MSBManager mgr = new JujuAdapter2MSBManager();
+ JSONObject resp = mgr.unregisterJujuAdapter(paramsMap);
+ assertTrue(resp != null);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManagerTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManagerTest.java
new file mode 100644
index 0000000..8fc108c
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/JujuClientManagerTest.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.adapter.impl;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class JujuClientManagerTest {
+
+ @Test
+ public void testdeploy() {
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.deploy("charmPath", "appName");
+ assertTrue(json != null);
+ }
+
+ @Test
+ public void testdeploy3() {
+ new MockUp<ProcessBuilder>() {
+ @Mock
+ public Process start() throws IOException {
+ Process process = new ProcessMockImpl();
+ return process;
+ }
+ };
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.deploy("charmPath","appName");
+ assertTrue(json != null);
+ }
+
+ @Test
+ public void testdeploy1() {
+
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.deploy("charmPath", null);
+ assertTrue(json != null);
+ }
+
+ @Test
+ public void testdeploy2() {
+
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.deploy(null, null);
+ assertTrue(json != null);
+ }
+
+ @Test
+@Ignore
+ public void testdestroy() {
+
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.destroy("appName");
+ assertTrue(json != null);
+ }
+
+ @Test
+ public void testdestroy1() {
+ new MockUp<ProcessBuilder>() {
+ @Mock
+ public Process start() throws IOException {
+ Process process = new ProcessMockImpl();
+ return process;
+ }
+ };
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.destroy("appName");
+ assertTrue(json != null);
+ }
+
+ @Test
+ public void testgetStatus() {
+
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.getStatus("appName");
+ assertTrue(json != null);
+ }
+
+ @Test
+ public void testgetStatus1() {
+
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.getStatus("");
+ assertTrue(json != null);
+ }
+
+ @Test
+ public void testgetStatus2() {
+ new MockUp<ProcessBuilder>() {
+ @Mock
+ public Process start() throws IOException {
+ Process process = new ProcessMockImpl();
+ return process;
+ }
+ };
+
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ JSONObject json = jujuClientManager.getStatus("");
+ assertTrue(json != null);
+ }
+ @Test
+ public void testParseYaml(){
+ JujuClientManager jujuClientManager = new JujuClientManager();
+ jujuClientManager.parseYaml("abc/efg", "mediawiki.yaml", "addResource");
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/ProcessMockImpl.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/ProcessMockImpl.java
new file mode 100644
index 0000000..da75931
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/adapter/impl/ProcessMockImpl.java
@@ -0,0 +1,76 @@
+/*
+ * 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.jujuvnfmadapter.service.adapter.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+
+public class ProcessMockImpl extends Process {
+
+ @Override
+ public OutputStream getOutputStream() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ // TODO Auto-generated method stub
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos;
+ /*try {
+ oos = new ObjectOutputStream(baos);
+ oos.writeObject(new Object());
+ oos.flush();
+ oos.close();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }*/
+
+ InputStream is = new ByteArrayInputStream(baos.toByteArray());
+ return is;
+ }
+
+ @Override
+ public InputStream getErrorStream() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int waitFor() throws InterruptedException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int exitValue() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrServiceTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrServiceTest.java
new file mode 100644
index 0000000..e2ef790
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/api/internalsvc/impl/JujuAdapterMgrServiceTest.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.api.internalsvc.impl;
+
+import org.junit.Test;
+
+public class JujuAdapterMgrServiceTest {
+
+ @Test
+ public void registerTest(){
+ JujuAdapterMgrService service = new JujuAdapterMgrService();
+ service.register();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ConstantTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ConstantTest.java
new file mode 100644
index 0000000..dff3c2b
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ConstantTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.constant;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant.AuthenticationMode;
+
+public class ConstantTest {
+
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = Constant.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+ @Test
+ public void testPrivateConstructor1() throws Exception {
+ Constructor constructor = Constant.AuthenticationMode.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstantsTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstantsTest.java
new file mode 100644
index 0000000..2ef3dea
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/ParamConstantsTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.constant;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+
+public class ParamConstantsTest {
+
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = ParamConstants.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstantTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstantTest.java
new file mode 100644
index 0000000..4e6b1ac
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/constant/UrlConstantTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.constant;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+
+import org.junit.Test;
+
+public class UrlConstantTest {
+
+ @Test
+ public void testPrivateConstructor() throws Exception {
+ Constructor constructor = UrlConstant.class.getDeclaredConstructor();
+ assertTrue("Constructor private", Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriverTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriverTest.java
new file mode 100644
index 0000000..cfef8bf
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuDriverTest.java
@@ -0,0 +1,309 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.CryptUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuDriver;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.VnfmOpResult;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+public class JujuDriverTest {
+
+ @Test
+ public void testGetServiceName() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getServiceName();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetServiceName() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setServiceName("testServiceName");
+ String result = jujudriver.getServiceName();
+ assertEquals("testServiceName", result);
+ }
+
+ @Test
+ public void testGetProtocol() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getProtocol();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetProtocol() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setProtocol("protocol");
+ String result = jujudriver.getProtocol();
+ assertEquals("protocol", result);
+ }
+
+ @Test
+ public void testGetVisualRange() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getVisualRange();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetVisualRange() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setVisualRange("getVisualRange");
+ String result = jujudriver.getVisualRange();
+ assertEquals("getVisualRange", result);
+ }
+
+ @Test
+ public void testGetVersion() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getVersion();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetVersion() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setVersion("testVersion");
+ String result = jujudriver.getVersion();
+ assertEquals("testVersion", result);
+ }
+
+ @Test
+ public void testGetUrl() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getUrl();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetUrl() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setUrl("testUrl");
+ String result = jujudriver.getUrl();
+ assertEquals("testUrl", result);
+ }
+
+ @Test
+ public void testGetIP() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getIP();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetIP() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setIP("testIP");
+ String result = jujudriver.getIP();
+ assertEquals("testIP", result);
+ }
+
+
+ @Test
+ public void testGetPort() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getPort();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetPort() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setPort("testPort");
+ String result = jujudriver.getPort();
+ assertEquals("testPort", result);
+ }
+
+ @Test
+ public void testGetTtl() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getTtl();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetTtl() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setTtl("testTtl");
+ String result = jujudriver.getTtl();
+ assertEquals("testTtl", result);
+ }
+
+ @Test
+ public void testGetStatus() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.getStatus();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetStatus() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setStatus("testStatus");
+ String result = jujudriver.getStatus();
+ assertEquals("testStatus", result);
+ }
+
+
+ @Test
+ public void testToString() {
+ JujuDriver jujudriver = new JujuDriver();
+ String result = jujudriver.toString();
+ assertEquals(
+ "JujuDriver[serviceName=<null>,protocol=<null>,version=<null>,visualRange=<null>,url=<null>,nodes=<null>,ip=<null>,port=<null>,ttl=<null>,status=<null>]",
+ result);
+ }
+
+ @Test
+ public void testToString1() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setServiceName("serviceName");
+ jujudriver.setProtocol("protocol");
+ jujudriver.setVersion("version");
+ jujudriver.setVisualRange("visualRange");
+ jujudriver.setUrl("testUrl");
+ jujudriver.setIP("testIP");
+ jujudriver.setPort("testPort");
+ jujudriver.setTtl("testTtl");
+ jujudriver.setStatus("testStatus");
+ String result = jujudriver.toString();
+ assertEquals(
+ "JujuDriver[serviceName=serviceName,protocol=protocol,version=version,visualRange=visualRange,url=testUrl,nodes=<null>,ip=testIP,port=testPort,ttl=testTtl,status=testStatus]",
+ result);
+ }
+
+ @Test
+ public void testHashCode() {
+ JujuDriver jujudriver = new JujuDriver();
+ int result = jujudriver.hashCode();
+ assertEquals(31, result);
+ }
+
+ @Test
+ public void testHashCode1() {
+ JujuDriver jujudriver = new JujuDriver();
+ jujudriver.setServiceName("serviceName");
+ int result = jujudriver.hashCode();
+ assertEquals(-1928572161, result);
+ }
+
+ @Test
+ public void testEquals() {
+ boolean result = new JujuDriver().equals(new JujuDriver());
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals1() {
+ boolean result = new JujuDriver().equals("");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals2() {
+ JujuVnfd obj = new JujuVnfd();
+ boolean result = new JujuDriver().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals3() {
+ JujuDriver obj = new JujuDriver();
+ obj.setServiceName("serviceName");
+ boolean result = new JujuDriver().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals4() {
+ JujuDriver obj = new JujuDriver();
+ boolean result = obj.equals(obj);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals5() {
+ boolean result = new JujuDriver().equals(null);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals6() {
+ JujuDriver jujudriver = new JujuDriver();
+ JujuDriver jujudriver2 = new JujuDriver();
+ jujudriver.setPort("");
+ jujudriver2.setPort("");
+ boolean result = jujudriver.equals(jujudriver2);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals7() {
+ JujuDriver jujudriver = new JujuDriver();
+ JujuDriver jujudriver2 = new JujuDriver();
+ jujudriver.setServiceName("serviceName");
+ jujudriver2.setServiceName("serName");
+ boolean result = jujudriver.equals(jujudriver2);
+ assertFalse(result);
+ }
+ @Test
+ public void JujuDriverConsTest(){
+ JSONObject jujuJsonObject = new JSONObject();
+ JSONArray array= new JSONArray();
+ array.add("1.1.1.1");
+ array.add("8080");
+ array.add("ttl");
+ jujuJsonObject.put("serviceName", "test123");
+ jujuJsonObject.put("protocol", "http");
+ jujuJsonObject.put("version", "v1");
+ jujuJsonObject.put("visualRange", "10");
+ jujuJsonObject.put("url", "/test");
+ jujuJsonObject.put("nodes", "[]");
+ jujuJsonObject.put("notes", array);
+ jujuJsonObject.put("status", "active");
+ JujuDriver driver = new JujuDriver(jujuJsonObject);
+ assertTrue("test123".equals(driver.getServiceName()));
+ }
+ @Test
+ public void testsetNodes() {
+ JujuDriver jujudriver = new JujuDriver();
+ List<String> nodes = new ArrayList<String>();
+ nodes.add("nodes");
+ jujudriver.setNodes(nodes);
+ }
+ @Test
+ public void testgetNodes() {
+ JujuDriver jujudriver = new JujuDriver();
+ List<String> nodes = new ArrayList<String>();
+ nodes.add("nodes");
+ jujudriver.getNodes();
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfdTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfdTest.java
new file mode 100644
index 0000000..b01e6c5
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfdTest.java
@@ -0,0 +1,154 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class JujuVnfdTest {
+
+ @Test
+ public void testGetDownloadUri() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ String result = jujuvnfd.getDownloadUri();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetDownloadUri() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ jujuvnfd.setDownloadUri("testDownloadUri");
+ String result = jujuvnfd.getDownloadUri();
+ assertEquals("testDownloadUri", result);
+ }
+
+ @Test
+ public void testGetLocalPath() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ String result = jujuvnfd.getLocalPath();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetProtocol() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ jujuvnfd.setLocalPath("testLocalPath");
+ String result = jujuvnfd.getLocalPath();
+ assertEquals("testLocalPath", result);
+ }
+
+
+ @Test
+ public void testToString() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ String result = jujuvnfd.toString();
+ assertEquals(
+ "JujuVnfd[downloadUri=<null>,localPath=<null>]",
+ result);
+ }
+
+ @Test
+ public void testToString1() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ jujuvnfd.setDownloadUri("testDownloadUri");
+ jujuvnfd.setLocalPath("testLocalPath");
+ String result = jujuvnfd.toString();
+ assertEquals(
+ "JujuVnfd[downloadUri=testDownloadUri,localPath=testLocalPath]",
+ result);
+ }
+
+ @Test
+ public void testHashCode() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ int result = jujuvnfd.hashCode();
+ assertEquals(31, result);
+ }
+
+ @Test
+ public void testHashCode1() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ jujuvnfd.setDownloadUri("testDownloadUri");
+ int result = jujuvnfd.hashCode();
+ assertEquals(-1870623759, result);
+ }
+
+ @Test
+ public void testEquals() {
+ boolean result = new JujuVnfd().equals(new JujuVnfd());
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals1() {
+ boolean result = new JujuVnfd().equals("");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals2() {
+ JujuDriver obj = new JujuDriver();
+ boolean result = new JujuVnfd().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals3() {
+ JujuVnfd obj = new JujuVnfd();
+ obj.setDownloadUri("testDownloadUri");
+ boolean result = new JujuVnfd().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals4() {
+ JujuVnfd obj = new JujuVnfd();
+ boolean result = obj.equals(obj);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals5() {
+ boolean result = new JujuVnfd().equals(null);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals6() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ JujuVnfd jujudriver2 = new JujuVnfd();
+ jujuvnfd.setDownloadUri("");
+ jujudriver2.setDownloadUri("");
+ boolean result = jujuvnfd.equals(jujudriver2);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals7() {
+ JujuVnfd jujuvnfd = new JujuVnfd();
+ JujuVnfd jujudriver2 = new JujuVnfd();
+ jujuvnfd.setDownloadUri("testDownloadUri");
+ jujudriver2.setDownloadUri("DownloadUri");
+ boolean result = jujuvnfd.equals(jujudriver2);
+ assertFalse(result);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExampleTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExampleTest.java
new file mode 100644
index 0000000..bf5f464
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoExampleTest.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample.Criteria;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample.Criterion;
+
+public class JujuVnfmInfoExampleTest {
+
+ JujuVnfmInfoExample jujuexample = new JujuVnfmInfoExample();
+ protected List<Criterion> criteria;
+ @Test
+ public void createCriteriaTest(){
+ Criteria criteria = jujuexample.createCriteria();
+ String condition = "";
+ String value = "";
+ String property = "";
+ String value1 = "";
+ String value2 = "";
+ Date d1 =new Date();
+ Date d2 =new Date();
+ List<String> values = new ArrayList<String>();
+ criteria.addCriterion(condition);
+ criteria.addCriterion(condition, value, property);
+ criteria.addCriterion(condition, value1, value2, property);
+ criteria.andDeleteTimeBetween(d1, d2);
+ criteria.andAppNameBetween(value1, value2);
+ criteria.andAppNameEqualTo(value);
+ criteria.andAppNameGreaterThan(value);
+ criteria.andAppNameGreaterThanOrEqualTo(value);
+ criteria.andAppNameIn(values);
+ criteria.andAppNameLessThan(value);
+ criteria.andIdLessThanOrEqualTo(value);
+ criteria.andAppNameLike(value2);
+ criteria.andAppNameNotBetween(value1, value2);
+ criteria.andAppNameNotEqualTo(value2);
+ criteria.andAppNameNotIn(values);
+ criteria.andIdNotLike(value2);
+ criteria.andCreateTimeBetween(d1, d2);
+ criteria.andCreateTimeNotBetween(d1, d2);
+ criteria.andJobIdBetween(value1, value2);
+ criteria.andJobIdNotBetween(value1, value2);
+ criteria.andModifyTimeBetween(d1, d2);
+ criteria.andJobIdEqualTo(value2);
+ criteria.andJobIdGreaterThan(value2);
+ criteria.andJobIdGreaterThanOrEqualTo(value2);
+ criteria.andJobIdIn(values);
+ criteria.andJobIdLessThan(value2);
+ criteria.andJobIdLessThanOrEqualTo(value2);
+ criteria.andJobIdLike(value2);
+ criteria.andJobIdNotBetween(value1, value2);
+ criteria.andJobIdNotEqualTo(value2);
+ criteria.andJobIdNotIn(values);
+ criteria.andJobIdNotLike(value2);
+ assertNotNull(criteria);
+ }
+ @Test
+ public void orTest(){
+ Criteria criteria = jujuexample.or();
+ assertNotNull(criteria);
+ }
+ @Test
+ public void clearTest(){
+ jujuexample.clear();
+ assertTrue(true);
+ }
+ @Test
+ public void CriteriaTest(){
+ JujuVnfmInfoExample.Criteria criteria = new JujuVnfmInfoExample.Criteria();
+ boolean isValid = criteria.isValid();
+ assertTrue(!isValid);
+ }
+
+ @Test
+ public void CriterionTest(){
+ String condition="";
+ String value="";
+ String secondValue="";
+ String typeHandler="";
+
+ Criterion c = new Criterion(condition, value, secondValue, typeHandler);
+ assertEquals(c.getCondition(), "");
+ assertEquals(c.getValue(), "");
+ assertEquals(c.getSecondValue(), "");
+ assertEquals(c.getTypeHandler(), "");
+ assertEquals(c.isSingleValue(), false);
+ assertEquals(c.isBetweenValue(), true);
+ assertEquals(c.isListValue(), false);
+
+ }
+
+ @Test
+ public void generatedCriteriaTest(){
+ JujuVnfmInfoExample.Criteria criteria = new JujuVnfmInfoExample.Criteria();
+ boolean isValid = criteria.isValid();
+
+ assertTrue(!isValid);
+ }
+
+ @Test
+ public void andIdIsNullTest(){
+ JujuVnfmInfoExample.Criteria criteria = new JujuVnfmInfoExample.Criteria();
+ Criteria c= criteria.andIdIsNull();
+ assertNotNull(c);
+ }
+ @Test
+ public void getConditionCroterionTest(){
+ JujuVnfmInfoExample.Criterion criterion = new JujuVnfmInfoExample.Criterion("test",new Object(),"typeHandler");
+ String condition = criterion.getCondition();
+ assertEquals(condition,"test");
+ }
+ @Test
+ public void testLimitStart() {
+ JujuVnfmInfoExample jujuVnfmInfoExample=new JujuVnfmInfoExample();
+ jujuVnfmInfoExample.setLimitStart(-1);
+
+ int result = jujuVnfmInfoExample.getLimitStart();
+ assertEquals(-1, result);
+ }
+ @Test
+ public void testLimitEnd() {
+ JujuVnfmInfoExample jujuVnfmInfoExample=new JujuVnfmInfoExample();
+ jujuVnfmInfoExample.setLimitEnd(-1);
+
+ int result = jujuVnfmInfoExample.getLimitEnd();
+ assertEquals(-1, result);
+ }
+ @Test
+ public void testOrderByClause() {
+ JujuVnfmInfoExample jujuVnfmInfoExample=new JujuVnfmInfoExample();
+ jujuVnfmInfoExample.setOrderByClause("order");
+
+ String result = jujuVnfmInfoExample.getOrderByClause();
+ assertEquals("order", result);
+ }
+ @Test
+ public void testsetDistinct() {
+ JujuVnfmInfoExample jujuVnfmInfoExample=new JujuVnfmInfoExample();
+ jujuVnfmInfoExample.setDistinct(true);
+
+ boolean result=jujuVnfmInfoExample.isDistinct();
+ assertEquals(true,result);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoTest.java
new file mode 100644
index 0000000..6707a3d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmInfoTest.java
@@ -0,0 +1,182 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import java.util.Date;
+
+public class JujuVnfmInfoTest {
+
+ @Test
+ public void testSetId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setId("testSetId");
+ String result = jujuVnfmInfo.getId();
+ assertEquals("testSetId", result);
+ }
+
+ @Test
+ public void testGetId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ String result = jujuVnfmInfo.getId();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetVnfmId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setVnfmId("testSetVnfmId");
+ String result = jujuVnfmInfo.getVnfmId();
+ assertEquals("testSetVnfmId", result);
+ }
+
+ @Test
+ public void testGetVnfmId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ String result = jujuVnfmInfo.getVnfmId();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetVnfId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setVnfId("testSetVnfId");
+ String result = jujuVnfmInfo.getVnfId();
+ assertEquals("testSetVnfId", result);
+ }
+
+ @Test
+ public void testGetVnfId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ String result = jujuVnfmInfo.getVnfId();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetAppName() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setAppName("testSetAppName");
+ String result = jujuVnfmInfo.getAppName();
+ assertEquals("testSetAppName", result);
+ }
+
+ @Test
+ public void testGetAppName() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ String result = jujuVnfmInfo.getAppName();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetJobId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setJobId("testSetJobId");
+ String result = jujuVnfmInfo.getJobId();
+ assertEquals("testSetJobId", result);
+ }
+
+ @Test
+ public void testGetJobId() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ String result = jujuVnfmInfo.getJobId();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetStatus() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setStatus(0);
+ Integer result = jujuVnfmInfo.getStatus();
+ assertEquals(Integer.valueOf(0), result);
+ }
+
+ @Test
+ public void testGetStatus() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ Integer result = jujuVnfmInfo.getStatus();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetCreateTime() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setCreateTime(new Date());
+ Date result = jujuVnfmInfo.getCreateTime();
+ assertEquals(new Date(), result);
+ }
+
+ @Test
+ public void testGetCreateTime() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ Date result = jujuVnfmInfo.getCreateTime();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetModifyTime() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setModifyTime(new Date());
+ Date result = jujuVnfmInfo.getModifyTime();
+ assertEquals(new Date(), result);
+ }
+
+ @Test
+ public void testGetModifyTime() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ Date result = jujuVnfmInfo.getModifyTime();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetDeleteTime() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setDeleteTime(new Date());
+ Date result = jujuVnfmInfo.getDeleteTime();
+ assertEquals(new Date(), result);
+ }
+
+ @Test
+ public void testGetDeleteTime() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ Date result = jujuVnfmInfo.getDeleteTime();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetExtend() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ jujuVnfmInfo.setExtend("testSetExtend");
+ String result = jujuVnfmInfo.getExtend();
+ assertEquals("testSetExtend", result);
+ }
+
+ @Test
+ public void testGetExtend() {
+ JujuVnfmInfo jujuVnfmInfo = new JujuVnfmInfo();
+ String result = jujuVnfmInfo.getExtend();
+ assertNull(result);
+ }
+
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmTest.java
new file mode 100644
index 0000000..744aeef
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/JujuVnfmTest.java
@@ -0,0 +1,347 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.CryptUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfm;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.VnfmOpResult;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class JujuVnfmTest {
+
+ @Test
+ public void testGetId() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getId();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetId() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setId("testId");
+ String result = jujuvnfm.getId();
+ assertEquals("testId", result);
+ }
+
+ @Test
+ public void testGetType() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getType();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetType() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setType("testType");
+ String result = jujuvnfm.getType();
+ assertEquals("testType", result);
+ }
+
+ @Test
+ public void testGetName() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getName();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetName() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setName("testName");
+ String result = jujuvnfm.getName();
+ assertEquals("testName", result);
+ }
+
+ @Test
+ public void testGetVersion() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getVersion();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetVersion() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setVersion("testVersion");
+ String result = jujuvnfm.getVersion();
+ assertEquals("testVersion", result);
+ }
+
+ @Test
+ public void testGetUserName() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getUserName();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetUserName() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setUserName("testUserName");
+ String result = jujuvnfm.getUserName();
+ assertEquals("testUserName", result);
+ }
+
+ @Test
+ public void testGetUrl() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getUrl();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetUrl() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setUrl("testUrl");
+ String result = jujuvnfm.getUrl();
+ assertEquals("testUrl", result);
+ }
+
+ @Test
+ public void testGetPwd() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getPwd();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetPwd() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setPwd("testPwd");
+ String result = jujuvnfm.getPwd();
+ assertEquals("testPwd", result);
+ }
+
+ @Test
+ public void testGetVender() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getVendor();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetVender() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setVendor("testVendor");
+ String result = jujuvnfm.getVendor();
+ assertEquals("testVendor", result);
+ }
+
+ @Test
+ public void testGetExtraInfo() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getExtraInfo();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetExtraInfo() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setExtraInfo("testExtraInfo");
+ String result = jujuvnfm.getExtraInfo();
+ assertEquals("testExtraInfo", result);
+ }
+
+ @Test
+ public void testGetStatus() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getStatus();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetStatus() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setStatus("testStatus");
+ String result = jujuvnfm.getStatus();
+ assertEquals("testStatus", result);
+ }
+
+ @Test
+ public void testGetCreateAt() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getCreateAt();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetCreateAt() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setCreateAt("testCreateAt");
+ String result = jujuvnfm.getCreateAt();
+ assertEquals("testCreateAt", result);
+ }
+
+ @Test
+ public void testGetUpdateAt() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.getUpdateAt();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetUpdateAt() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setUpdateAt("testUpdateAt");
+ String result = jujuvnfm.getUpdateAt();
+ assertEquals("testUpdateAt", result);
+ }
+
+ @Test
+ public void testToString() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ String result = jujuvnfm.toString();
+ assertEquals(
+ "JujuVnfm[id=<null>,name=<null>,type=<null>,version=<null>,userName=<null>,pwd=<null>,url=<null>,vendor=<null>,extraInfo=<null>,status=<null>,createAt=<null>,updateAt=<null>]",
+ result);
+ }
+
+ @Test
+ public void testToString1() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setId("testId");
+ jujuvnfm.setType("testType");
+ jujuvnfm.setName("testName");
+ jujuvnfm.setVersion("testVersion");
+ jujuvnfm.setUserName("testUserName");
+ jujuvnfm.setUrl("testUrl");
+ jujuvnfm.setPwd("testPwd");
+ jujuvnfm.setVendor("testVendor");
+ jujuvnfm.setExtraInfo("testExtraInfo");
+ jujuvnfm.setStatus("testStatus");
+ jujuvnfm.setCreateAt("testCreateAt");
+ jujuvnfm.setUpdateAt("testUpdateAt");
+ String result = jujuvnfm.toString();
+ assertEquals(
+ "JujuVnfm[id=testId,name=testName,type=testType,version=testVersion,userName=testUserName,pwd=testPwd,url=testUrl,vendor=testVendor,extraInfo=testExtraInfo,status=testStatus,createAt=testCreateAt,updateAt=testUpdateAt]",
+ result);
+ }
+
+ @Test
+ public void testHashCode() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ int result = jujuvnfm.hashCode();
+ assertEquals(31, result);
+ }
+
+ @Test
+ public void testHashCode1() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setId("testId");
+ int result = jujuvnfm.hashCode();
+ assertEquals(-877170324, result);
+ }
+
+ @Test
+ public void testEquals() {
+ boolean result = new JujuVnfm().equals(new JujuVnfm());
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals1() {
+ boolean result = new JujuVnfm().equals("");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals2() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ jujuvnfm.setId("testId");
+ VnfmOpResult obj = new VnfmOpResult();
+ boolean result = new JujuVnfm().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals3() {
+ JujuVnfm obj = new JujuVnfm();
+ obj.setId("testId");
+ boolean result = new JujuVnfm().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals4() {
+ JujuVnfm obj = new JujuVnfm();
+ boolean result = obj.equals(obj);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals5() {
+ boolean result = new JujuVnfm().equals(null);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals6() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ JujuVnfm vnfm2 = new JujuVnfm();
+ jujuvnfm.setId("");
+ vnfm2.setId("");
+ boolean result = jujuvnfm.equals(vnfm2);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals7() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ JujuVnfm vnfm2 = new JujuVnfm();
+ jujuvnfm.setId("vnfmId");
+ vnfm2.setId("vnfm2Id");
+ boolean result = jujuvnfm.equals(vnfm2);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testUpdateVnfm() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ JSONObject obj = new JSONObject();
+ obj.put("name", "name");
+ obj.put("userName", "userName");
+ obj.put("pwd", "pwd");
+ obj.put("extraInfo", "extraInfo");
+ jujuvnfm.updateVnfm(obj);
+ assertEquals("name", jujuvnfm.getName());
+ assertEquals("userName", jujuvnfm.getUserName());
+ }
+
+ @Test
+ public void testUpdateVnfmByEmpty() {
+ JujuVnfm jujuvnfm = new JujuVnfm();
+ JSONObject obj = new JSONObject();
+ obj.put("name", "");
+ obj.put("userName", "");
+ obj.put("pwd", "");
+ obj.put("extraInfo", "");
+ jujuvnfm.updateVnfm(obj);
+ assertNull(jujuvnfm.getName());
+ assertNull(jujuvnfm.getUserName());
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntityTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntityTest.java
new file mode 100644
index 0000000..2f3ec92
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/MSBRequestEntityTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.MSBRequestEntity.Node;
+
+public class MSBRequestEntityTest {
+ MSBRequestEntity msbRequestEntity = new MSBRequestEntity();
+
+ @Test
+ public void testMSBRequestEntity() {
+ List<Node> nodes = new ArrayList<>();
+ msbRequestEntity.setNodes(nodes);
+ String protocol = "protocol";
+ msbRequestEntity.setProtocol(protocol);
+ String serviceName = "serviceName";
+ msbRequestEntity.setServiceName(serviceName);
+ String status = "status";
+ msbRequestEntity.setStatus(status);
+ String url = "url";
+ msbRequestEntity.setUrl(url);
+ String version = "version";
+ msbRequestEntity.setVersion(version);
+ String visualRange = " visualRange";
+ msbRequestEntity.setVisualRange(visualRange);
+ msbRequestEntity.toString();
+ assertEquals(msbRequestEntity.getNodes(), nodes);;
+ assertEquals(msbRequestEntity.getNodes(), nodes);
+ assertEquals(msbRequestEntity.getProtocol(), protocol);
+ assertEquals(msbRequestEntity.getServiceName(), serviceName);
+ assertEquals(msbRequestEntity.getStatus(), status);
+ assertEquals(msbRequestEntity.getUrl(), url);
+ assertEquals(msbRequestEntity.getVersion(), version);
+ assertEquals(msbRequestEntity.getVisualRange(), visualRange);
+ }
+
+ @Test
+ public void testNode() {
+ Node n = new Node();
+ String createdAt = "Test";
+ n.setCreatedAt(createdAt);
+ String ip = "192.168.4.47";
+ n.setIp(ip);
+ String expiration = "";
+ n.setExpiration(expiration);
+ String port = "80";
+ n.setPort(port);
+ String updatedAt = "";
+ n.setUpdatedAt(updatedAt);
+ String ttl = "";
+ n.setTtl(ttl);
+
+ assertEquals(n.getCreatedAt(), "Test");
+ assertEquals(n.getIp(), "192.168.4.47");
+ assertEquals(n.getExpiration(), "");
+ assertEquals(n.getPort(),"80");
+ assertEquals(n.getUpdatedAt(), "");
+ assertEquals(n.getTtl(), "");
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResultTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResultTest.java
new file mode 100644
index 0000000..5089682
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmOpResultTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.VnfmOpResult;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.VnfmOpResult.TaskStatus;
+
+public class VnfmOpResultTest {
+
+ @Test
+ public void testVnfmOpResult() {
+ VnfmOpResult result = new VnfmOpResult();
+ assertEquals(TaskStatus.INIT, result.getOperateStatus());
+ assertEquals("", result.getErrorMessage());
+ }
+
+ @Test
+ public void testVnfmOpResult1() {
+ VnfmOpResult result = new VnfmOpResult(TaskStatus.SUCCESS, "success");
+ assertEquals(TaskStatus.SUCCESS, result.getOperateStatus());
+ assertEquals("success", result.getErrorMessage());
+ }
+
+ @Test
+ public void testSotOperateStatus() {
+ VnfmOpResult result = new VnfmOpResult();
+ result.setOperateStatus(TaskStatus.SUCCESS);
+ assertEquals(TaskStatus.SUCCESS, result.getOperateStatus());
+ }
+
+ @Test
+ public void testSotOperateStatusByNull() {
+ VnfmOpResult result = new VnfmOpResult();
+ result.setOperateStatus(null);
+ assertNull(result.getOperateStatus());
+ }
+
+ @Test
+ public void testSotErrorMessage() {
+ VnfmOpResult result = new VnfmOpResult();
+ result.setErrorMessage("Fail!");
+ assertEquals("Fail!", result.getErrorMessage());
+ }
+
+ @Test
+ public void testSotErrorMessageByNull() {
+ VnfmOpResult result = new VnfmOpResult();
+ result.setErrorMessage(null);
+ assertNull(result.getErrorMessage());
+ }
+
+ @Test
+ public void testAddResult() {
+ VnfmOpResult result = new VnfmOpResult();
+ result.addResult("Result");
+ List<String> arr = new ArrayList<String>();
+ arr.add("Result");
+ assertEquals(arr, result.getResult());
+ }
+
+ @Test
+ public void testAddResultByList() {
+ VnfmOpResult result = new VnfmOpResult();
+ List<String> arr = new ArrayList<String>();
+ arr.add("Result");
+ arr.add("Test");
+ result.addResult(arr);
+ assertEquals(arr, result.getResult());
+ }
+
+ @Test
+ public void testAddResultByNull() {
+ VnfmOpResult result = new VnfmOpResult();
+ List<String> arr = new ArrayList<String>();
+ arr.add(null);
+ result.addResult(null);
+ assertEquals(arr, result.getResult());
+ }
+
+ @Test
+ public void testToString() {
+ VnfmOpResult result = new VnfmOpResult();
+ assertEquals(
+ "org.openo.nfvo.jujuvnfmadapter.service.entity.VnfmOpResult@[operateStatus=INIT, errorCode=0, errorMessage=]",
+ result.toString());
+ }
+
+ @Test
+ public void testToString1() {
+ VnfmOpResult result = new VnfmOpResult(TaskStatus.SUCCESS, "success");
+ assertEquals(
+ "org.openo.nfvo.jujuvnfmadapter.service.entity.VnfmOpResult@[operateStatus=SUCCESS, errorCode=0, errorMessage=success]",
+ result.toString());
+ }
+
+ @Test
+ public void testTaskStatus() {
+ VnfmOpResult result=new VnfmOpResult();
+ assertEquals(TaskStatus.INIT, TaskStatus.valueOf("INIT"));
+ assertEquals(TaskStatus.SUCCESS, TaskStatus.valueOf("SUCCESS"));
+ assertEquals(TaskStatus.PART_SUCCESS, TaskStatus.valueOf("PART_SUCCESS"));
+ assertEquals(TaskStatus.RUNNING, TaskStatus.valueOf("RUNNING"));
+ assertEquals(TaskStatus.TIMEOUT, TaskStatus.valueOf("TIMEOUT"));
+ assertEquals(TaskStatus.FAIL, TaskStatus.valueOf("FAIL"));
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmTest.java
new file mode 100644
index 0000000..5eaf230
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/entity/VnfmTest.java
@@ -0,0 +1,347 @@
+/*
+ * 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.jujuvnfmadapter.service.entity;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.CryptUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.Vnfm;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.VnfmOpResult;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class VnfmTest {
+
+ @Test
+ public void testGetId() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getId();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetId() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setId("testId");
+ String result = vnfm.getId();
+ assertEquals("testId", result);
+ }
+
+ @Test
+ public void testGetType() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getType();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetType() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setType("testType");
+ String result = vnfm.getType();
+ assertEquals("testType", result);
+ }
+
+ @Test
+ public void testGetName() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getName();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetName() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setName("testName");
+ String result = vnfm.getName();
+ assertEquals("testName", result);
+ }
+
+ @Test
+ public void testGetVersion() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getVersion();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetVersion() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setVersion("testVersion");
+ String result = vnfm.getVersion();
+ assertEquals("testVersion", result);
+ }
+
+ @Test
+ public void testGetUserName() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getUserName();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetUserName() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setUserName("testUserName");
+ String result = vnfm.getUserName();
+ assertEquals("testUserName", result);
+ }
+
+ @Test
+ public void testGetUrl() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getUrl();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetUrl() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setUrl("testUrl");
+ String result = vnfm.getUrl();
+ assertEquals("testUrl", result);
+ }
+
+ @Test
+ public void testGetPwd() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getPwd();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetPwd() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setPwd("testPwd");
+ String result = vnfm.getPwd();
+ assertEquals("testPwd", result);
+ }
+
+ @Test
+ public void testGetSites() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getSites();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetSites() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setSites("testSites");
+ String result = vnfm.getSites();
+ assertEquals("testSites", result);
+ }
+
+ @Test
+ public void testGetExtraInfo() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getExtraInfo();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetExtraInfo() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setExtraInfo("testExtraInfo");
+ String result = vnfm.getExtraInfo();
+ assertEquals("testExtraInfo", result);
+ }
+
+ @Test
+ public void testGetStatus() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getStatus();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetStatus() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setStatus("testStatus");
+ String result = vnfm.getStatus();
+ assertEquals("testStatus", result);
+ }
+
+ @Test
+ public void testGetCreateAt() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getCreateAt();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetCreateAt() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setCreateAt("testCreateAt");
+ String result = vnfm.getCreateAt();
+ assertEquals("testCreateAt", result);
+ }
+
+ @Test
+ public void testGetUpdateAt() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.getUpdateAt();
+ assertNull(result);
+ }
+
+ @Test
+ public void testSetUpdateAt() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setUpdateAt("testUpdateAt");
+ String result = vnfm.getUpdateAt();
+ assertEquals("testUpdateAt", result);
+ }
+
+ @Test
+ public void testToString() {
+ Vnfm vnfm = new Vnfm();
+ String result = vnfm.toString();
+ assertEquals(
+ "Vnfm[id=<null>,name=<null>,type=<null>,version=<null>,userName=<null>,pwd=<null>,url=<null>,sites=<null>,extraInfo=<null>,status=<null>,createAt=<null>,updateAt=<null>]",
+ result);
+ }
+
+ @Test
+ public void testToString1() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setId("testId");
+ vnfm.setType("testType");
+ vnfm.setName("testName");
+ vnfm.setVersion("testVersion");
+ vnfm.setUserName("testUserName");
+ vnfm.setUrl("testUrl");
+ vnfm.setPwd("testPwd");
+ vnfm.setSites("testSites");
+ vnfm.setExtraInfo("testExtraInfo");
+ vnfm.setStatus("testStatus");
+ vnfm.setCreateAt("testCreateAt");
+ vnfm.setUpdateAt("testUpdateAt");
+ String result = vnfm.toString();
+ assertEquals(
+ "Vnfm[id=testId,name=testName,type=testType,version=testVersion,userName=testUserName,pwd=testPwd,url=testUrl,sites=testSites,extraInfo=testExtraInfo,status=testStatus,createAt=testCreateAt,updateAt=testUpdateAt]",
+ result);
+ }
+
+ @Test
+ public void testHashCode() {
+ Vnfm vnfm = new Vnfm();
+ int result = vnfm.hashCode();
+ assertEquals(31, result);
+ }
+
+ @Test
+ public void testHashCode1() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setId("testId");
+ int result = vnfm.hashCode();
+ assertEquals(-877170324, result);
+ }
+
+ @Test
+ public void testEquals() {
+ boolean result = new Vnfm().equals(new Vnfm());
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals1() {
+ boolean result = new Vnfm().equals("");
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals2() {
+ Vnfm vnfm = new Vnfm();
+ vnfm.setId("testId");
+ VnfmOpResult obj = new VnfmOpResult();
+ boolean result = new Vnfm().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals3() {
+ Vnfm obj = new Vnfm();
+ obj.setId("testId");
+ boolean result = new Vnfm().equals(obj);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals4() {
+ Vnfm obj = new Vnfm();
+ boolean result = obj.equals(obj);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals5() {
+ boolean result = new Vnfm().equals(null);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testEquals6() {
+ Vnfm vnfm = new Vnfm();
+ Vnfm vnfm2 = new Vnfm();
+ vnfm.setId("");
+ vnfm2.setId("");
+ boolean result = vnfm.equals(vnfm2);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testEquals7() {
+ Vnfm vnfm = new Vnfm();
+ Vnfm vnfm2 = new Vnfm();
+ vnfm.setId("vnfmId");
+ vnfm2.setId("vnfm2Id");
+ boolean result = vnfm.equals(vnfm2);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testUpdateVnfm() {
+ Vnfm vnfm = new Vnfm();
+ JSONObject obj = new JSONObject();
+ obj.put("name", "name");
+ obj.put("userName", "userName");
+ obj.put("pwd", "pwd");
+ obj.put("extraInfo", "extraInfo");
+ vnfm.updateVnfm(obj);
+ assertEquals("name", vnfm.getName());
+ assertEquals("userName", vnfm.getUserName());
+ }
+
+ @Test
+ public void testUpdateVnfmByEmpty() {
+ Vnfm vnfm = new Vnfm();
+ JSONObject obj = new JSONObject();
+ obj.put("name", "");
+ obj.put("userName", "");
+ obj.put("pwd", "");
+ obj.put("extraInfo", "");
+ vnfm.updateVnfm(obj);
+ //assertNull(vnfm.getName());
+ //assertNull(vnfm.getUserName());
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationExceptionTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationExceptionTest.java
new file mode 100644
index 0000000..6baaf57
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/exception/UnsupportedOperationExceptionTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.exception;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class UnsupportedOperationExceptionTest {
+ UnsupportedOperationException mess;
+
+ @Before
+ public void setUp(){
+ mess = new UnsupportedOperationException();
+ }
+
+ @Test
+ public void test() {
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItemTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItemTest.java
new file mode 100644
index 0000000..84dc214
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigItemTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.juju.config;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ConfigItemTest {
+
+ @Test
+ public void testsetDefaults() {
+ ConfigItem configItem = new ConfigItem();
+ configItem.setDefaults("");
+ String result = configItem.getDefaults();
+ assertEquals("", result);
+ }
+ @Test
+ public void testsetdescription() {
+ ConfigItem configItem = new ConfigItem();
+ configItem.setDescription("");
+ String result = configItem.getDescription();
+ assertEquals("", result);
+ }
+ @Test
+ public void testsettype() {
+ ConfigItem configItem = new ConfigItem();
+ configItem.setType("");
+ String result = configItem.getType();
+ assertEquals("", result);
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigTest.java
new file mode 100644
index 0000000..ee3faee
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/ConfigTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.juju.config;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigTest {
+ @Test
+ public void testsetDefaults() {
+
+ Map<String,ConfigItem> options=new HashMap<String,ConfigItem> ();
+ ConfigItem configItem=new ConfigItem();
+ configItem.setDescription("");
+ options.put("", configItem);
+ Config config=new Config(options);
+ config.setOptions(options);
+ Map map=config.getOptions();
+ assertEquals(options, map);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/OptionsTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/OptionsTest.java
new file mode 100644
index 0000000..76e5b3e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/juju/config/OptionsTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.juju.config;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import mockit.MockUp;
+
+public class OptionsTest {
+
+ @Test
+ public void test() {
+ Options o=new Options();
+ new MockUp<Options>() {
+
+ };
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgrTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgrTest.java
new file mode 100644
index 0000000..1a9ae6e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfMgrTest.java
@@ -0,0 +1,404 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.process;
+
+import static org.junit.Assert.*;
+
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.VnfmUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IResourceManager;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class VnfMgrTest {
+
+ VnfMgr mgr;
+ @Before
+ public void setUp() {
+ mgr = new VnfMgr();
+ mgr.getJujuVnfmInfoMapper();
+ mgr.getResourceManager();
+
+ }
+
+ @Test
+ public void addVnfTestNullJson() {
+ JSONObject vnfObject = new JSONObject();
+ String vnfmId = "1234";
+ JSONObject resp = mgr.addVnf(vnfObject, vnfmId);
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void addVnfTestOk() {
+
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject vnfmObject = new JSONObject();
+ vnfmObject.put("url", "http://localhost:8080");
+ return vnfmObject;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>() {
+
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params,
+ String domainTokens) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(200);
+ return resp;
+ }
+ };
+ JSONObject vnfObject = new JSONObject();
+ vnfObject.put("vnfInstanceName", "test123");
+ vnfObject.put("vnfPackageId", "123");
+ String vnfmId = "1234";
+ JSONObject resp = mgr.addVnf(vnfObject, vnfmId);
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void addVnfTestNull() {
+
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject vnfmObject = new JSONObject();
+ return vnfmObject;
+ }
+ };
+ JSONObject vnfObject = new JSONObject();
+ vnfObject.put("vnfInstanceName", "test123");
+ String vnfmId = "1234";
+ JSONObject resp = mgr.addVnf(vnfObject, vnfmId);
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void addVnfTestNullRes() {
+
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject vnfmObject = new JSONObject();
+ vnfmObject.put("url", "http://localhost:8080");
+ return vnfmObject;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>() {
+
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params,
+ String domainTokens) {
+
+ return null;
+ }
+ };
+ JSONObject vnfObject = new JSONObject();
+ vnfObject.put("vnfInstanceName", "test123");
+ String vnfmId = "1234";
+ JSONObject resp = mgr.addVnf(vnfObject, vnfmId);
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void deleteVnfTestNullJson() {
+
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ return null;
+ }
+ };
+ JSONObject vnfObject = new JSONObject();
+ vnfObject.put("vnfInstanceName", "test123");
+ String vnfmId = "1234";
+ JSONObject resp = mgr.deleteVnf("vnfId", "vnfmId", vnfObject);
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void deleteVnfTestValidJson() {
+
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject obj = new JSONObject();
+ obj.put("url", "http://localhost:8080");
+ return obj;
+ }
+ };
+ new MockUp<VnfMgr>(){
+ @Mock
+ private JujuVnfmInfo findByVnfId(String vnfId){
+ JujuVnfmInfo info = new JujuVnfmInfo();
+ info.setVnfmId("1234");
+ return info;
+ }
+ };
+ JSONObject vnfObject = new JSONObject();
+ vnfObject.put("vnfInstanceName", "test123");
+ String vnfmId = "1234";
+ JSONObject resp = mgr.deleteVnf("vnfId", "vnfmId", vnfObject);
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void deleteVnf2TestNormal() {
+
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject obj = new JSONObject();
+ obj.put("url", "http://localhost:8080");
+ return obj;
+ }
+ };
+ new MockUp<VnfMgr>(){
+ @Mock
+ private JujuVnfmInfo findByVnfId(String vnfId){
+ JujuVnfmInfo info = new JujuVnfmInfo();
+ info.setVnfmId("1234");
+ return info;
+ }
+ @Mock
+ private void delJujuVnfmInfo(String vnfId){
+ return;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(204);
+ return resp;
+ }
+ };
+ JSONObject vnfObject = new JSONObject();
+ vnfObject.put("vnfInstanceName", "test123");
+ String vnfmId = "1234";
+ JSONObject resp = mgr.deleteVnf("vnfId", "vnfmId", vnfObject);
+ assertEquals(resp.get("retCode"), 1);
+ }
+
+ @Test
+ public void getVnfTestNullResp() {
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ return null;
+ }
+ };
+ JSONObject resp = mgr.getVnf("vnfId", "vnfmId");
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void getVnfTestValidJson() {
+ new MockUp<VnfmUtil>() {
+
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject obj = new JSONObject();
+ obj.put("url", "http://localhost:8080");
+ return obj;
+ }
+ };
+ new MockUp<VnfMgr>(){
+ @Mock
+ private JujuVnfmInfo findByVnfId(String vnfId){
+ JujuVnfmInfo info = new JujuVnfmInfo();
+ info.setVnfmId("1234");
+ return info;
+ }
+ @Mock
+ private void delJujuVnfmInfo(String vnfId){
+ return;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ RestfulResponse resp = new RestfulResponse();
+ resp.setStatus(201);
+ JSONObject obj = new JSONObject();
+ obj.put("data", new JSONObject());
+ resp.setResponseJson(obj.toString());
+ return resp;
+ }
+ };
+ JSONObject resp = mgr.getVnf("vnfId", "vnfmId");
+ assertEquals(resp.get("retCode"), -1);
+ }
+
+ @Test
+ public void getJobTestNullResp(){
+ new MockUp<VnfmUtil>() {
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ return null;
+ }
+ };
+ JSONObject resp = mgr.getJob("jobId", "vnfmId");
+ assertEquals(resp.get("retCode"), null);
+ }
+
+ @Test
+ public void getJobTestNullHttpResp(){
+ new MockUp<VnfmUtil>() {
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject ret = new JSONObject();
+ ret.put("url", "http://localhost:8080");
+ return ret;
+ }
+ };
+ JSONObject resp = mgr.getJob("jobId", "vnfmId");
+ assertEquals(resp.get("retCode"), null);
+ }
+ @Test
+ public void getJobTestSuccessWithNullData(){
+ new MockUp<VnfmUtil>() {
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject ret = new JSONObject();
+ ret.put("url", "http://localhost:8080");
+ return ret;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ RestfulResponse res = new RestfulResponse();
+ res.setStatus(201);
+
+ return res;
+ }
+ };
+ JSONObject resp = mgr.getJob("jobId", "vnfmId");
+ assertEquals(resp.get("retCode"), null);
+ }
+ @Test
+ public void getJobTestOkWithNullData(){
+ new MockUp<VnfmUtil>() {
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject ret = new JSONObject();
+ ret.put("url", "http://localhost:8080");
+ return ret;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ RestfulResponse res = new RestfulResponse();
+ res.setStatus(200);
+
+ return res;
+ }
+ };
+ JSONObject resp = mgr.getJob("jobId", "vnfmId");
+ assertEquals(resp.get("retCode"), null);
+ }
+ @Test
+ public void getJobTestInternalError(){
+ new MockUp<VnfmUtil>() {
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject ret = new JSONObject();
+ ret.put("url", "http://localhost:8080");
+ return ret;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ RestfulResponse res = new RestfulResponse();
+ res.setStatus(500);
+
+ return res;
+ }
+ };
+ JSONObject resp = mgr.getJob("jobId", "vnfmId");
+ assertEquals(resp.get("retCode"), null);
+ }
+ @Test
+ public void getJobTestNormal(){
+ new MockUp<VnfmUtil>() {
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject ret = new JSONObject();
+ ret.put("url", "http://localhost:8080");
+ return ret;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ RestfulResponse res = new RestfulResponse();
+ JSONObject jsonData = new JSONObject();
+ jsonData.put("data", new JSONObject());
+ res.setStatus(200);
+ res.setResponseJson(jsonData.toString());
+ return res;
+ }
+ };
+ JSONObject resp = mgr.getJob("jobId", "vnfmId");
+ assertEquals(resp.get("retCode"), null);
+ }
+ @Test
+ public void getJobTestNullData(){
+ new MockUp<VnfmUtil>() {
+ @Mock
+ public JSONObject getVnfmById(String vnfmId) {
+ JSONObject ret = new JSONObject();
+ ret.put("url", "http://localhost:8080");
+ return ret;
+ }
+ };
+ new MockUp<VnfmRestfulUtil>(){
+ @Mock
+ public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params, String domainTokens) {
+ RestfulResponse res = new RestfulResponse();
+ JSONObject jsonData = new JSONObject();
+ jsonData.put("data", null);
+ res.setStatus(200);
+ res.setResponseJson(jsonData.toString());
+ return res;
+ }
+ };
+ JSONObject resp = mgr.getJob("jobId", "vnfmId");
+ assertEquals(resp.get("retCode"),null);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgrTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgrTest.java
new file mode 100644
index 0000000..013ecd7
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/process/VnfResourceMgrTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.process;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample.Criteria;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfoExample.Criterion;
+import org.openo.nfvo.jujuvnfmadapter.service.mapper.JujuVnfmInfoMapper;
+
+import mockit.Expectations;
+import mockit.Mock;
+import mockit.MockUp;
+import mockit.Mocked;
+import mockit.integration.junit4.JMockit;
+import net.sf.json.JSONObject;
+import static mockit.Deencapsulation.*;
+
+
+@RunWith(JMockit.class)
+
+public class VnfResourceMgrTest {
+ VnfResourceMgr vnfMgr;
+ JujuVnfmInfoMapper jujuVnfmInfoMapper;
+ JujuVnfmInfoExample jujuexample = new JujuVnfmInfoExample();
+ Criteria criteria = jujuexample.createCriteria();
+
+ @Before
+ public void setUp() {
+ vnfMgr = new VnfResourceMgr();
+ vnfMgr.setJujuVnfmInfoMapper(jujuVnfmInfoMapper);
+ vnfMgr.getJujuVnfmInfoMapper();
+ }
+
+ @Test
+ public void grantVnfResourceTest() throws ServiceException {
+
+ String vnfId = "1";
+ new Expectations(vnfMgr) {
+ {
+ invoke(vnfMgr, "findByVnfId", "1");
+ JujuVnfmInfo info = new JujuVnfmInfo();
+ info.setId("1");
+ info.setAppName("Test");
+ info.setJobId("1");
+ info.setVnfId(vnfId);
+ returns(info);
+ }
+ };
+ JSONObject compute = new JSONObject();
+ JSONObject res = vnfMgr.grantVnfResource(compute, vnfId);
+ assertEquals(res.get("retCode"), -1);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoaTest.java
new file mode 100644
index 0000000..53893a5
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ConfigRoaTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.rest;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.nfvo.jujuvnfmadapter.common.JujuConfigUtil;
+import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class ConfigRoaTest {
+ ConfigRoa roa;
+
+ @Before
+ public void setUp() {
+ roa = new ConfigRoa();
+ }
+
+ @Test
+ public void initUITest() {
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.initUI(context, resp);
+ assertNotNull(res);
+ }
+
+ @Test
+ public void setDebugModelTest() throws ServiceException {
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ boolean res = roa.setDebugModel(1, context, resp);
+ assertTrue(res);
+ }
+
+ @Test
+ public void setDebug2ModelTest() throws ServiceException {
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ boolean res = roa.setDebugModel(2, context, resp);
+ assertFalse(res);
+ }
+
+ @Test
+ public void testmock() throws ServiceException {
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String methodName = "getVnfmById";
+ JSONObject json = new JSONObject();
+
+ new MockUp<JujuConfigUtil>() {
+ @Mock
+ public String getValue(String key) {
+ return null;
+ }
+
+ };
+ roa.mock(methodName, context, resp);
+ roa.unmock(methodName, context, resp);
+
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoaTest.java
new file mode 100644
index 0000000..4f02669
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/JujuClientRoaTest.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2016-2017 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.jujuvnfmadapter.service.rest;
+
+import static org.junit.Assert.assertNotNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.JujuClientManager;
+import org.openo.nfvo.jujuvnfmadapter.service.process.VnfMgr;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class JujuClientRoaTest {
+
+ JujuClientRoa roa;
+
+
+ @Before
+ public void setUp(){
+ roa = new JujuClientRoa();
+ roa.setJujuClientManager(new JujuClientManager());
+ roa.getJujuClientManager();
+
+ }
+
+ @Test
+ public void setCharmUrlTest() throws ServiceException {
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest context) {
+ String reqJsonObject = "{}";
+ return (T)JSONObject.fromObject(reqJsonObject);
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.setCharmUrl(context, resp);
+ assertNotNull(res);
+ }
+ @Test
+ public void getVnfStatusTest() throws ServiceException {
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.getVnfStatus("appName", context,resp);
+ assertNotNull(res);
+ }
+ @Test
+ public void deploySerivceTestFail() throws ServiceException {
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.deploySerivce(context,resp);
+ assertNotNull(res);
+ }
+ @Test
+ public void deploySerivceTest() throws ServiceException {
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ JSONObject reqJsonObject = new JSONObject();
+ reqJsonObject.put("charmPath", "/abc/xyz");
+ reqJsonObject.put("mem", "100");
+ reqJsonObject.put("appName", "test");
+ return (T)reqJsonObject;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.deploySerivce(context,resp);
+ assertNotNull(res);
+ }
+
+ @Test
+ public void destroySerivceTestFail() throws ServiceException {
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ JSONObject reqJsonObject = new JSONObject();
+ reqJsonObject.put("charmPath", "/abc/xyz");
+ reqJsonObject.put("mem", "100");
+ reqJsonObject.put("appName", "test");
+ return (T)reqJsonObject;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.destroySerivce(context,resp);
+ assertNotNull(res);
+ }
+// @Test
+// public void destroySerivce2TestFail() throws ServiceException {
+// new MockUp<StringUtil>(){
+// @Mock
+// public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+// JSONObject reqJsonObject = new JSONObject();
+// reqJsonObject.put("appName", "test");
+// return (T)reqJsonObject;
+// }
+// };
+// HttpServletRequest context = null;
+// HttpServletResponse resp = new MockHttpServletResponse();
+// String res = roa.destroySerivce(context,resp);
+// assertNotNull(res);
+// }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/TestMockUp.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/TestMockUp.java
new file mode 100644
index 0000000..0fd6300
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/TestMockUp.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016-2017, 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.jujuvnfmadapter.service.rest;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Nov 2, 2016
+ */
+public class TestMockUp {
+ ConfigRoa roa;
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since NFVO 0.5
+ */
+ @Before
+ public void setUp() throws Exception {
+ roa = new ConfigRoa();
+ }
+
+ @Test
+ public void test() {
+ new MockUp<StringUtil>(){
+ @Mock
+ public boolean isValidUrl(String url) {
+ return true;
+ }
+
+ };
+ Assert.assertTrue(StringUtil.isValidUrl("abc"));
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoaTest.java
new file mode 100644
index 0000000..4732233
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfResourceRoaTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.rest;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.process.VnfResourceMgr;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class VnfResourceRoaTest {
+
+ VnfResourceRoa roa = new VnfResourceRoa();
+
+ @Before
+ public void setUp(){
+ roa.setVnfResourceMgr(new VnfResourceMgr());
+ }
+
+ @Test
+ public void grantVnfResTest() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest context) {
+ String reqJsonObject = "{}";
+ return (T)JSONObject.fromObject(reqJsonObject);
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfId = "1234";
+ String res = roa.grantVnfRes(context, vnfId);
+ assertNotNull(res);
+ }
+
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoaTest.java
new file mode 100644
index 0000000..e88054f
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/VnfRoaTest.java
@@ -0,0 +1,215 @@
+/*
+ * 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.jujuvnfmadapter.service.rest;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Context;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.common.StringUtil;
+import org.openo.nfvo.jujuvnfmadapter.service.entity.JujuVnfmInfo;
+import org.openo.nfvo.jujuvnfmadapter.service.process.VnfMgr;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+public class VnfRoaTest {
+
+ VnfRoa roa = new VnfRoa();
+ @Before
+ public void setUp(){
+ roa.setVnfMgr(new VnfMgr());
+ }
+
+ @Test
+ public void addVnfTestNull() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.addVnf(context, resp, vnfmId);
+ assertNotNull(res);
+ }
+
+ @Test
+ public void addVnfTest() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ String vnfJsonStr = "{}";
+ return (T)JSONObject.fromObject(vnfJsonStr);
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.addVnf(context, resp, vnfmId);
+ assertNotNull(res);
+ }
+ @Test
+ public void delVnfTestNull() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ new MockUp<VnfMgr>(){
+ @Mock
+ private JujuVnfmInfo findByVnfId(String vnfId){
+ JujuVnfmInfo info = new JujuVnfmInfo();
+ info.setVnfmId("1234");
+ return info;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.delVnf("vnfmId", resp, "vnfInstanceId",context);
+ assertNotNull(res);
+ }
+ @Test
+ public void delVnf2TestNull() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.delVnf(null, resp, "vnfInstanceId",context);
+ assertNotNull(res);
+ }
+ @Test
+ public void delVnf3TestNull() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.delVnf(vnfmId, resp, null,context);
+ assertNotNull(res);
+ }
+ @Test
+ public void getVnf1TestNull() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ new MockUp<VnfMgr>(){
+ @Mock
+ private JujuVnfmInfo findByVnfId(String vnfId){
+ JujuVnfmInfo info = new JujuVnfmInfo();
+ info.setVnfmId("1234");
+ return info;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.getVnf(vnfmId, resp, "vnfInstanceId",context);
+ assertNotNull(res);
+ }
+ @Test
+ public void getVnf2TestNull() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.getVnf(null, resp, "vnfInstanceId",context);
+ assertNotNull(res);
+ }
+ @Test
+ public void getVnf3TestNull() throws ServiceException{
+ new MockUp<StringUtil>(){
+ @Mock
+ public <T> T getJsonFromContexts(HttpServletRequest vnfReq) {
+ return null;
+ }
+ };
+ HttpServletRequest context = null;
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String vnfmId = "1234";
+ String res = roa.getVnf(vnfmId, resp, null,context);
+ assertNotNull(res);
+ }
+ @Test
+ public void getJobTestNull() throws ServiceException{
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.getJob("jobId", "vnfmId", resp,"responseId");
+ assertNotNull(res);
+ }
+ @Test
+ public void getJobTest2Null() throws ServiceException{
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.getJob(null, "vnfmId", resp,"responseId");
+ assertNotNull(res);
+ }
+ @Test
+ public void getJobTest3Null() throws ServiceException{
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.getJob("jobId", null, resp,"responseId");
+ assertNotNull(res);
+ }
+
+ @Test
+ public void getJobTestNormal() throws ServiceException{
+ new MockUp<VnfMgr>(){
+ @Mock
+ public JSONObject getJob(String jobId, String vnfmId) {
+ JSONObject obj = new JSONObject();
+ JSONObject dataObj = new JSONObject();
+ dataObj.put("id", "1234");
+ dataObj.put("status", "Success");
+ obj.put("data", dataObj);
+ obj.put("retCode", 1);
+ return obj;
+ }
+
+ };
+ HttpServletResponse resp = new MockHttpServletResponse();
+ String res = roa.getJob("jobId", "vnfmId", resp,"responseId");
+ assertNotNull(res);
+ }
+
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessageTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessageTest.java
new file mode 100644
index 0000000..1b497bf
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ExceptionMessageTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.rest.exceptionmapper;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ExceptionMessageTest {
+
+ ExceptionMessage mess;
+
+ @Before
+ public void setUp(){
+ mess = new ExceptionMessage();
+ }
+
+ @Test
+ public void getErrorCodeTest() {
+ String errorCode = "404";
+ String message = "success";
+ int httpCode = 200;
+ mess.setErrorCode(errorCode);
+ mess.setMessage(message);
+ mess.setHttpCode(httpCode);
+ assertEquals(mess.getErrorCode(), errorCode);
+ assertEquals(mess.getHttpCode(),httpCode);
+ assertEquals(mess.getMessage(),message);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapperTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapperTest.java
new file mode 100644
index 0000000..9582f9d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/GenericExceptionMapperTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.rest.exceptionmapper;
+
+import static org.junit.Assert.*;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class GenericExceptionMapperTest {
+
+ GenericExceptionMapper genericExpMess;
+
+
+ @Before
+ public void setUp(){
+ genericExpMess = new GenericExceptionMapper();
+ }
+
+
+ @Test
+ public void toResponseTest() {
+ Response resp = genericExpMess.toResponse(new Exception("Testing"));
+ assertEquals(resp.getStatus(),500);
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapperTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapperTest.java
new file mode 100644
index 0000000..14c027a
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/exceptionmapper/ServiceExceptionMapperTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2017 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.jujuvnfmadapter.service.rest.exceptionmapper;
+
+import static org.junit.Assert.*;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+public class ServiceExceptionMapperTest {
+
+ ServiceExceptionMapper serviceExMapper;
+
+
+ @Before
+ public void setUp(){
+ serviceExMapper = new ServiceExceptionMapper();
+ }
+
+
+ @Test
+ public void toResponseTest() {
+ Response resp = serviceExMapper.toResponse(new ServiceException("Testing"));
+ assertEquals(resp.getStatus(),500);
+
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/JujuClientRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/JujuClientRoaTest.java
new file mode 100644
index 0000000..959f374
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/JujuClientRoaTest.java
@@ -0,0 +1,163 @@
+/*
+ * 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.jujuvnfmadapter.service.rest.fullstack;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils.ExeRes;
+import org.openo.nfvo.jujuvnfmadapter.service.adapter.inf.IResourceManager;
+import org.openo.nfvo.jujuvnfmadapter.service.rest.JujuClientRoa;
+import org.python.jline.internal.Log;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import mockit.Mock;
+import mockit.MockUp;
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Nov 3, 2016
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({"classpath:test.xml"})
+public class JujuClientRoaTest {
+
+ Logger logger = Logger.getLogger(JujuClientRoaTest.class);
+
+ @Resource
+ private JujuClientRoa jujuClientRoa;
+ @Resource
+ private IResourceManager resourceManager;
+
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since NFVO 0.5
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @Test
+ public void test() {
+ Assert.assertNotNull(jujuClientRoa);
+ }
+
+ @Test
+ public void testSetCharmUrl() {
+ HttpServletResponse resp = new MockHttpServletResponse();
+ HttpServletRequest request;
+ String result = null;
+ try {
+ request = TestHelper.buildDefaultRequest("setCharmUrl.json");
+ result = jujuClientRoa.setCharmUrl(request, resp);
+
+ } catch(Exception e) {
+ logger.error("error:",e);
+
+ }
+ Assert.assertNotNull(result);
+ }
+
+ @Test
+ public void testGetVnfStatus() {
+
+ //mock method EntityUtils#execute
+ new MockUp<EntityUtils>(){
+ @Mock
+ public ExeRes execute(String dir, List<String> command) {
+ ExeRes res = new ExeRes();
+ res.setCode(ExeRes.SUCCESS);
+ res.setBody(null);
+ return res;
+ }
+ };
+
+ HttpServletResponse resp = new MockHttpServletResponse();
+ MockHttpServletRequest request;
+ String result = null;
+ try {
+ request = TestHelper.buildDefaultRequest(null);
+ String modelName = "mediawiki.yaml";
+ request.setParameter("modelName", modelName);
+ result = jujuClientRoa.getVnfStatus(modelName, request, resp);
+ Log.info(result);
+ } catch(Exception e) {
+ logger.error("error:",e);
+
+ }
+ JSONObject jr = JSONObject.fromObject(result);
+ Assert.assertNotNull(result);
+ Assert.assertEquals(0, jr.getInt("retCode"));
+ }
+
+ // @Test
+ public void testDeploySerivce() {
+ HttpServletResponse resp = new MockHttpServletResponse();
+ HttpServletRequest request;
+ String result = null;
+ try {
+ request = TestHelper.buildDefaultRequest("deployService.json");
+ result = jujuClientRoa.deploySerivce(request, resp);
+ Assert.assertNotNull(result);
+ JSONObject json = JSONObject.fromObject(result);
+ logger.info(json);
+ Assert.assertEquals(json.getInt(EntityUtils.RESULT_CODE_KEY),EntityUtils.ExeRes.SUCCESS);
+
+ } catch(Exception e) {
+ logger.error("error:",e);
+
+ }
+
+ }
+
+// @Test
+ public void testDestroySerivce() {
+ HttpServletResponse resp = new MockHttpServletResponse();
+ HttpServletRequest request;
+ String result = null;
+ try {
+ request = TestHelper.buildDefaultRequest("destroySerivce.json");
+ result = jujuClientRoa.setCharmUrl(request, resp);
+
+ } catch(Exception e) {
+ logger.error("error:",e);
+
+ }
+ Assert.assertNotNull(result);
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/TestHelper.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/TestHelper.java
new file mode 100644
index 0000000..cf8bc30
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/fullstack/TestHelper.java
@@ -0,0 +1,72 @@
+/*
+ * 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.jujuvnfmadapter.service.rest.fullstack;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.openo.nfvo.jujuvnfmadapter.common.FileUtils;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Nov 3, 2016
+ */
+public class TestHelper {
+
+ @SuppressWarnings("deprecation")
+ public static MockHttpServletRequest buildMockRequest(File file) throws FileNotFoundException, IOException {
+
+ String contnet = IOUtils.toString(new FileInputStream(file));
+ byte[] content = contnet.getBytes();
+ MockHttpServletRequest context = new MockHttpServletRequest();
+ context.setContentType("application/json");
+ context.setContent(content);
+ return context;
+ }
+
+ public static MockHttpServletRequest buildMockRequest(String content) throws FileNotFoundException, IOException {
+ MockHttpServletRequest context = new MockHttpServletRequest();
+ context.setContentType("application/json");
+ context.setContent(content.getBytes());
+ return context;
+ }
+
+ public static MockHttpServletRequest buildDefaultRequest(String fileName)
+ throws FileNotFoundException, IOException {
+ MockHttpServletRequest context = new MockHttpServletRequest();
+ context.setContentType("application/json");
+ if(fileName != null) {
+ String file = FileUtils.getClassPath() + File.separator + fileName;
+ InputStream input = new FileInputStream(file);
+ @SuppressWarnings("deprecation")
+ String contnet = IOUtils.toString(input);
+ byte[] content = contnet.getBytes();
+ context.setContent(content);
+ }
+ return context;
+ }
+
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/deployService.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/deployService.json
new file mode 100644
index 0000000..6dc211e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/deployService.json
@@ -0,0 +1,4 @@
+{
+"appName":"test.yaml",
+"charmPath":"E:/workspace/openo-common-utils/src/org/openo/common/yaml"
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/destroyService.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/destroyService.json
new file mode 100644
index 0000000..7a73a41
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/destroyService.json
@@ -0,0 +1,2 @@
+{
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/example.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/example.json
new file mode 100644
index 0000000..5fefaa8
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/example.json
@@ -0,0 +1 @@
+{"InstallTime": "1295768962", "Comments": "Will test without extension.", "Theme": "classic/1.0", "Version": "4.0b10pre", "id": "ec8030f7-c20a-464f-9b0e-13a3a9e97384", "Vendor": "Mozilla", "EMCheckCompatibility": "false", "Throttleable": "1", "Email": "deinspanjer@mozilla.com", "URL": "http://nighthacks.com/roller/jag/entry/the_shit_finally_hits_the", "version": "4.0b10pre", "CrashTime": "1295903735", "ReleaseChannel": "nightly", "submitted_timestamp": "2011-01-24T13:15:48.550858", "buildid": "20110121153230", "timestamp": 1295903748.551002, "Notes": "Renderers: 0x22600,0x22600,0x20400", "StartupTime": "1295768964", "FramePoisonSize": "4096", "FramePoisonBase": "7ffffffff0dea000", "AdapterRendererIDs": "0x22600,0x22600,0x20400", "Add-ons": "compatibility@addons.mozilla.org:0.7,enter.selects@agadak.net:6,{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}:1.3.3,sts-ui@sidstamm.com:0.1,masspasswordreset@johnathan.nightingale:1.04,support@lastpass.com:1.72.0,{972ce4c6-7e08-4474-a285-3208198ce6fd}:4.0b10pre", "BuildID": "20110121153230", "SecondsSinceLastCrash": "810473", "ProductName": "Firefox", "legacy_processing": 0} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/setCharmUrl.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/setCharmUrl.json
new file mode 100644
index 0000000..7a73a41
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/setCharmUrl.json
@@ -0,0 +1,2 @@
+{
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.xml
new file mode 100644
index 0000000..0663c14
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+ xmlns:ctx="http://www.springframework.org/schema/context"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/osgi-compendium
+ http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
+ http://cxf.apache.org/jaxrs
+ http://cxf.apache.org/schemas/jaxrs.xsd
+ http://cxf.apache.org/transports/http/configuration
+ http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://www.springframework.org/schema/aop
+ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd" >
+
+ <import resource="classpath:spring/JujuVnfmadapter/services.xml"/>
+
+</beans> \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.yaml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.yaml
new file mode 100644
index 0000000..00c532d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/resources/test.yaml
@@ -0,0 +1,10 @@
+name: Test User
+
+address:
+ line1: My Address Line 1
+ line2: Address line 2
+ city: Washington D.C.
+ zip: 20000
+roles:
+ - User
+ - Editor \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/webapp/webtest.xml b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/webapp/webtest.xml
new file mode 100644
index 0000000..dd71a96
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/test/webapp/webtest.xml
@@ -0,0 +1,15 @@
+<!--
+ 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.
+ -->
diff --git a/juju/juju-vnfmadapter/pom.xml b/juju/juju-vnfmadapter/pom.xml
new file mode 100644
index 0000000..e63e5b0
--- /dev/null
+++ b/juju/juju-vnfmadapter/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.nfvo</groupId>
+ <artifactId>nfvo-root</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../../../..</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openo.nfvo</groupId>
+ <artifactId>juju-vnfmadapter</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>nfvo/drivers/vnfm/gvnfm/juju/juju-vnfmadapter</name>
+ <description>nfvo juju-vnfmadapter</description>
+ <modules>
+ <module>Juju-vnfmadapterService</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19</version>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ <includes>
+ <include>**/*Spec*</include>
+ <include>**/Test*.java</include>
+ <include>**/*Test.java</include>
+ <include>**/*TestCase.java</include>
+ <include>**/Test*.scala</include>
+ <include>**/*Test.scala</include>
+ <include>**/*TestCase.scala</include>
+ </includes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <formats>
+ <format>html</format>
+ <format>xml</format>
+ </formats>
+ <instrumentation>
+ <excludes>
+ <exclude>org/**/*Test.class</exclude>
+ </excludes>
+ </instrumentation>
+ <check/>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>