Map<String, String> uniqueResourcePortNetworkRole,
HeatOrchestrationTemplate heatOrchestrationTemplate,
GlobalValidationContext globalValidationContext) {
+ if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources().get(resourceId).getProperties())) {
+ return;
+ }
Object propertyNetworkValue =
heatOrchestrationTemplate.getResources().get(resourceId).getProperties().get("networks");
if (propertyNetworkValue != null && propertyNetworkValue instanceof List) {
private Map<String, String> validateImageAndFlavorFromNovaServer(String fileName,
Map.Entry<String, Resource> resourceEntry,
GlobalValidationContext globalContext) {
+ Map<String, String> imageAndFlavorLegalNames = new HashMap<>();
+
if (MapUtils.isEmpty(resourceEntry.getValue().getProperties())) {
- return null;
+ return imageAndFlavorLegalNames;
}
Pair<String, String> imagePair = new ImmutablePair<>("image", ".*_image_name");
Pair<String, String> flavorPair = new ImmutablePair<>("flavor", ".*_flavor_name");
List<Pair<String, String>> imageFlavorPairs = Arrays.asList(imagePair, flavorPair);
Map<String, Object> propertiesMap = resourceEntry.getValue().getProperties();
- Map<String, String> imageAndFlavorLegalNames = new HashMap<>();
for (Pair<String, String> imageOrFlavor : imageFlavorPairs) {
boolean isErrorInImageOrFlavor =
}
@Test
- public void testNovaImageAndFlavorNames() {
+ public void testNovaImageAndFlavorNamesEmptyProperties() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
+ PATH + "heatNovaServerImageAndFlavor/negativeEmptyProperties");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(1, messages.size());
+ Assert.assertEquals(1, messages.get("first.yaml").getErrorMessageList().size());
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [NNS13]: Server 'image' Parameter Name not aligned with Guidelines, Parameter Name [fsb2-image], Resource ID [FSB3]. As a result, VF/VFC Profile may miss this information");
+ }
+
+ @Test
+ public void testNovaImageAndFlavorNames() {
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "heatNovaServerImageAndFlavor/positive");
Assert.assertNotNull(messages);
--- /dev/null
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "file": "first.yaml",
+ "type": "HEAT",
+ "isBase": true,
+ "data": [
+ ]
+ }
+ ]
+}
--- /dev/null
+heat_template_version: 2013-05-23
+
+description: heat expose volume resource
+
+resources:
+ FSB2:
+ type: OS::Nova::Server
+ properties:
+
+ FSB3:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: fsb2_name_2 }
+ block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }]
+ image: { get_param: fsb2-image }
+ availability_zone: { get_param: availability_zone_0 }
+ metadata:
+ VNF_id: { get_param: vnfvfVF_id }
+ vf_module_id: { get_param: vf_module_id }
+ networks:
+ - port: { get_resource: FSB2_Internal1 }
+ - port: { get_resource: FSB2_Internal2 }
+ - port: { get_resource: FSB2_OAM }
+
+outputs:
+ expose_resource_nove_output:
+ description: the pcrf_server
+ value: { get_resource: FSB2 }
+
+