Write Groovy Scripts

In this section we create the PushFunctions.groovy file. This file will contain static functions that are used during the mapping of the root instance.

package mappings.scripts

public class PushFunctions {
	
	public static boolean isVirtual(def nodeRole){
		return isListContainsOne(def list, "MY_VM", "MY_SIMULATOR");
	}
	
public static String getDescription(boolean isVirtual){
		if(isVirtual){
			return "This is a VM";
		}
		else{
			return "This is physical machine";
		}
	}

private static boolean isListContainsOne(def list, ...stringList){
		//returns true if the list contains one of the values.
	}
}