class NovaLauncher extends Launcher {

  public String createSecurityGroup(String clusterName, String groupName, Nova nova, Set<String> ports) {
    String securityGroupUniqueName = NovaSetting.NOVA_UNIQUE_GROUP_NAME(clusterName, groupName);
    logger.info(String.format("Creating security group '%s' ...", securityGroupUniqueName));
    SecurityGroupApi client = novaContext.getSecurityGroupApi();
    String groupId;
    //TODO Do we have something similar to VPC EC2 in Nova?
    SecurityGroup created = client.createWithDescription(securityGroupUniqueName, NovaSetting
              .NOVA_UNIQUE_GROUP_DESCRIPTION(clusterName, groupName));
    //Get id of the security group
    groupId = created.getId();
    //Go over the ips
    if (!TESTING) {
      for (String port : ports) {
        Integer portNumber;
        IpProtocol ipProtocol;
        if (port.contains("/")) {
          String[] s = port.split("/");
          portNumber = Integer.valueOf(s[0]);
          ipProtocol = IpProtocol.valueOf(s[1]);
        } else {
          portNumber = Integer.valueOf(port);
          ipProtocol = IpProtocol.TCP;
        }
        Ingress ingress = Ingress.builder()
                .fromPort(portNumber)
                .toPort(portNumber)
                .ipProtocol(ipProtocol)
                .build();

        client.createRuleAllowingCidrBlock(groupId, ingress, "0.0.0.0/0");
        logger.info(String.format("Ports became open for '%s'", securityGroupUniqueName));
      }
    } else {
      Ingress ingress = Ingress.builder()
              .fromPort(1)
              .toPort(65535)
              .ipProtocol(IpProtocol.TCP)
              .build();
      client.createRuleAllowingCidrBlock(groupId, ingress, "0.0.0.0/0");
      logger.info(String.format("Ports became open for '%s'", securityGroupUniqueName));
    }
    logger.info(String.format("Security group '%s' was created :)", securityGroupUniqueName));
    return groupId;
  }

  public  NovaLauncher(NovaContext novaContext, SshKeyPair sshKeyPair);

}