@BeforeTest(alwaysRun = true) public void init() throws Exception { service = new HpGrizzlyCloudService(); super.bootstrap(service); cloud = service.getCloud(); initClients(); // install service with network String simpleServicePath = CommandTestUtils.getPath(USM_SERVICES_PATH + SERVICE_NAME); super.installServiceAndWait(simpleServicePath, SERVICE_NAME); }
private void initClients() { try { Map<String, Object> properties = service.getProperties(); String tenant = properties.get(PROPERTY_TENANT).toString(); String username = properties.get(PROPERTY_USER).toString(); String password = properties.get(PROPERTY_API_KEY).toString(); String endpoint = properties.get(PROPERTY_OPENSTACK_URL).toString(); // calculating the region by the image id of the management template String managementTemplateName = cloud.getConfiguration().getManagementMachineTemplate(); ComputeTemplate managementTemplate = cloud.getCloudCompute().getTemplates().get(managementTemplateName); String region = managementTemplate.getImageId().split("/")[0]; computeClient = new OpenStackComputeClient(endpoint, username, password, tenant, region); networkClient = new OpenStackNetworkClient(endpoint, username, password, tenant, region); } catch (OpenstackJsonSerializationException e) { throw new IllegalStateException(e); } }