OpenStackNetworkConfigurationHelper { protected void validateNetworkNames(final CloudNetwork cloudNetwork) throws CloudProvisioningException { final ManagementNetwork mn = cloudNetwork.getManagement(); if (mn != null) { this.validateNetworkName(mn.getNetworkConfiguration()); } final Collection<NetworkConfiguration> templates = cloudNetwork.getTemplates().values(); if (templates != null && !templates.isEmpty()) { for (NetworkConfiguration nc : templates) { this.validateNetworkName(nc); } } } OpenStackNetworkConfigurationHelper();   OpenStackNetworkConfigurationHelper(final ComputeDriverConfiguration configuration); NetworkConfiguration getManagementNetworkTemplate(); NetworkConfiguration getApplicationNetworkTemplate(); boolean useManagementNetwork(); boolean useApplicationNetworkTemplate(); String getManagementNetworkPrefixedName(); String getApplicationNetworkPrefixedName(); String getPrivateIpNetworkName(); List<String> getComputeNetworks(); AccessRules getServiceAccessRules(); boolean isValidSubnetName(final org.cloudifysource.domain.cloud.network.Subnet subnet); boolean isValidSubnetRange(final org.cloudifysource.domain.cloud.network.Subnet subnet); boolean isValidNetworkName(final NetworkConfiguration networkConfiguration); void validateNetworkName(final NetworkConfiguration networkConfiguration); boolean isCreateExternalRouter(); String getExternalRouterName(); boolean isCreateExternalNetwork(); String getExternalNetworkName(); boolean skipExternalNetworking(); boolean associateFloatingIp();  }
@Test public void testValidateNetworkNames() { try { new OpenStackNetworkConfigurationHelper().validateNetworkNames(cloudNetwork); new OpenStackNetworkConfigurationHelper().validateNetworkNames(new CloudNetwork()); } catch (CloudProvisioningException e) { Assert.fail("Test should pass but got " + e.getMessage()); } }
@Test(expected = CloudProvisioningException.class) public void missingManagementNetworkNameTest() throws CloudProvisioningException { cloudNetwork.getManagement().getNetworkConfiguration().setName(null); new OpenStackNetworkConfigurationHelper().validateNetworkNames(cloudNetwork); }
@Test(expected = CloudProvisioningException.class) public void missingManagementSubnetNameTest() throws CloudProvisioningException { cloudNetwork.getManagement().getNetworkConfiguration().getSubnets().get(0).setName(null); new OpenStackNetworkConfigurationHelper().validateNetworkNames(cloudNetwork); }
@Test(expected = CloudProvisioningException.class) public void missingApplicationNetworkNameTest() throws CloudProvisioningException { cloudNetwork.getTemplates().get(APPLICATION_NET).setName(null); new OpenStackNetworkConfigurationHelper().validateNetworkNames(cloudNetwork); }
@Test(expected = CloudProvisioningException.class) public void missingApplicationSubnetNameTest() throws CloudProvisioningException { cloudNetwork.getTemplates().get(APPLICATION_NET).getSubnets().get(0).setName(null); new OpenStackNetworkConfigurationHelper().validateNetworkNames(cloudNetwork); }