diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java index 62ab317ed30..9d0e942bd0e 100644 --- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java +++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/api/command/CreateServiceInstanceCmd.java @@ -90,7 +90,8 @@ public class CreateServiceInstanceCmd extends BaseAsyncCreateCmd { description = "The service offering ID that defines the resources consumed by the service appliance") private Long serviceOfferingId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING) + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, + required = true, description = "The name of the service instance") private String name; /// Implementation @@ -126,6 +127,10 @@ public class CreateServiceInstanceCmd extends BaseAsyncCreateCmd { throw new InvalidParameterValueException("Invalid ID for right network " + rightNetworkId); } + if (name.isEmpty()) { + throw new InvalidParameterValueException("service instance name is empty"); + } + ServiceVirtualMachine svm = _vrouterService.createServiceInstance(zone, owner, template, serviceOffering, name, left, right); if (svm == null) {