diff options
3 files changed, 19 insertions, 2 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__Update_Optical_Service_Recipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__Update_Optical_Service_Recipe.sql new file mode 100644 index 0000000000..e97df04ef6 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__Update_Optical_Service_Recipe.sql @@ -0,0 +1,6 @@ +use catalogdb; + +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (15,NULL,'createInstance',NULL,'2.0','UNI-UNI','OTN UNI-UNI resource create recipe','/mso/async/services/CreateSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (16,NULL,'deleteInstance',NULL,'2.0','UNI-UNI','OTN UNI-UNI resource delete recipe','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (17,NULL,'createInstance',NULL,'2.0','UNI-ENNI','OTN UNI-ENNI resource create recipe','/mso/async/services/CreateSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (18,NULL,'deleteInstance',NULL,'2.0','UNI-ENNI','OTN UNI-ENNI resource delete recipe','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03'); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 6d3b0ab680..e83ec8387a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -278,6 +278,9 @@ public class HeatBridgeImpl implements HeatBridgeApi { @Override public void createPserversAndPinterfacesIfNotPresentInAai(final List<Resource> stackResources) throws HeatBridgeException { + if (stackResources == null) { + return; + } Map<String, Pserver> serverHostnames = getPserverMapping(stackResources); createPServerIfNotExists(serverHostnames); List<String> portIds = @@ -294,8 +297,13 @@ public class HeatBridgeImpl implements HeatBridgeApi { private Map<String, Pserver> getPserverMapping(final List<Resource> stackResources) { List<Server> osServers = getAllOpenstackServers(stackResources); Map<String, Pserver> pserverMap = new HashMap<>(); - for (Server server : osServers) { - pserverMap.put(server.getHost(), aaiHelper.buildPserver(server)); + if (osServers != null) { + for (Server server : osServers) { + Pserver pserver = aaiHelper.buildPserver(server); + if (pserver != null) { + pserverMap.put(server.getHost(), pserver); + } + } } return pserverMap; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java index adcde92917..727cdccff5 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java @@ -146,6 +146,9 @@ public class AaiHelper { * @return AAI Pserver object */ public Pserver buildPserver(final Server server) { + if (server == null || server.getHypervisorHostname() == null) { + return null; + } Pserver pserver = new Pserver(); pserver.setInMaint(false); pserver.setHostname(server.getHypervisorHostname()); |