mirror of
https://github.com/apache/jclouds.git
synced 2025-02-09 11:35:41 +00:00
Azure ARM fixes
This commit is contained in:
parent
053a18ab16
commit
397b0c9ba4
@ -2,7 +2,8 @@ jclouds Labs - Azure Compute ARM Provider
|
||||
============
|
||||
|
||||
Build status for azurecomputearm module:
|
||||
[![Build Status](http://devopsfunjenkins.westus.cloudapp.azure.com:8080/buildStatus/icon?job=jclouds-labs-azurecompute-arm/org.apache.jclouds.labs:azurecomputearm)](http://devopsfunjenkins.westus.cloudapp.azure.com:8080/job/jclouds-labs-azurecompute-arm/org.apache.jclouds.labs$azurecomputearm/)
|
||||
[![Build Status](https://jclouds.ci.cloudbees.com/buildStatus/icon?job=jclouds-labs/org.apache.jclouds.labs$azurecompute-arm)](https://jclouds.ci.cloudbees.com/buildStatus/icon?job=jclouds-labs/org.apache.jclouds.labs$azurecompute-arm)
|
||||
|
||||
|
||||
|
||||
## Setting Up Test Credentials
|
||||
@ -42,68 +43,23 @@ Run the following commands to assign roles to the service principal
|
||||
```bash
|
||||
# Assign roles for this service principal
|
||||
azure role assignment create --objectId <Object-id> -o Contributor -c /subscriptions/<Subscription-id>/
|
||||
|
||||
```
|
||||
|
||||
Verify service principal
|
||||
|
||||
```bash
|
||||
azure login -u <Application-id> -p <password> --service-principal --tenant <Tenant-id>
|
||||
|
||||
```
|
||||
|
||||
## Run Live Tests
|
||||
|
||||
|
||||
Use the following to run the live tests
|
||||
|
||||
```bash
|
||||
# ResourceGroupApiLiveTest:
|
||||
|
||||
mvn -Dtest=ResourceGroupApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# AuthorizationApiLiveTest:
|
||||
|
||||
mvn -Dtest=AuthorizationApiLiveTest -Dtest.oauth.identity=<Application-id> -Dtest.oauth.credential=<password> -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" -Dtest.jclouds.oauth.audience="https://management.azure.com/" test
|
||||
|
||||
# LocationApiLiveTest:
|
||||
|
||||
mvn -Dtest=LocationApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# StorageAccountApiLiveTest:
|
||||
|
||||
mvn -Dtest=StorageAccountApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# VirtualNetworkApiLiveTest:
|
||||
|
||||
mvn -Dtest=VirtualNetworkApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.resourcegroup="jcloudstest" -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# SubnetApiLiveTest
|
||||
|
||||
mvn -Dtest=SubnetApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.resourcegroup="jcloudstest" -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# NetworkInterfaceCardApiLiveTest
|
||||
|
||||
mvn -Dtest=NetworkInterfaceCardApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.resourcegroup="jcloudstest" -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# VirtualMachineApiLiveTest:
|
||||
|
||||
mvn -Dtest=VirtualMachineApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# VMSizeApiLiveTest:
|
||||
|
||||
mvn -Dtest=VMSizeApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# PublicIPAddressApiLiveTest
|
||||
|
||||
mvn -Dtest=PublicIPAddressApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# OSImageApiLiveTest:
|
||||
|
||||
mvn -Dtest=OSImageApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
# DeploymentApiLiveTest:
|
||||
|
||||
mvn -Dtest=DeploymentApiLiveTest -Dtest.azurecompute-arm.identity=<Application-id> -Dtest.azurecompute-arm.subscriptionid=<Subscription-id> -Dtest.azurecompute-arm.credential=<password> -Dtest.azurecompute-arm.endpoint="https://management.azure.com/" -Dtest.jclouds.oauth.resource="https://management.azure.com/" -Dtest.oauth.endpoint="https://login.microsoftonline.com/<Tenant-id>/oauth2/token" test
|
||||
|
||||
mvn clean verify -Plive \
|
||||
-Dtest.azurecompute-arm.identity=<Application-id> \
|
||||
-Dtest.azurecompute-arm.credential=<password> \
|
||||
-Dtest.azurecompute-arm.endpoint=https://management.azure.com/subscriptions/<Subscription-id> \
|
||||
-Dtest.oauth.endpoint=https://login.microsoftonline.com/<Tenant-id>/oauth2/token
|
||||
```
|
@ -31,10 +31,10 @@
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<properties>
|
||||
<test.jclouds.azurecompute-arm.subscription-id>FIXME_subscription-id</test.jclouds.azurecompute-arm.subscription-id>
|
||||
<test.jclouds.azurecompute-arm.tenant-id>FIXME_tenant-id</test.jclouds.azurecompute-arm.tenant-id>
|
||||
<test.azurecompute-arm.endpoint>https://management.azure.com/subscriptions/${test.jclouds.azurecompute-arm.subscription-id}</test.azurecompute-arm.endpoint>
|
||||
<test.azurecompute-arm.api-version>2014-04-01-preview</test.azurecompute-arm.api-version>
|
||||
<test.jclouds.oauth.resource>https://management.azure.com/</test.jclouds.oauth.resource>
|
||||
<test.oauth.endpoint>https://login.microsoftonline.com/FIXME_tenant-id/oauth2/token</test.oauth.endpoint>
|
||||
<test.azurecompute-arm.endpoint>https://management.azure.com/subscriptions/FIXME_subscription-id</test.azurecompute-arm.endpoint>
|
||||
<test.azurecompute-arm.api-version></test.azurecompute-arm.api-version>
|
||||
<test.azurecompute-arm.build-version />
|
||||
<test.azurecompute-arm.identity>app id</test.azurecompute-arm.identity>
|
||||
<test.azurecompute-arm.credential>app password</test.azurecompute-arm.credential>
|
||||
@ -162,8 +162,8 @@
|
||||
<test.azurecompute-arm.build-version>${test.azurecompute-arm.build-version}</test.azurecompute-arm.build-version>
|
||||
<test.azurecompute-arm.identity>${test.azurecompute-arm.identity}</test.azurecompute-arm.identity>
|
||||
<test.azurecompute-arm.credential>${test.azurecompute-arm.credential}</test.azurecompute-arm.credential>
|
||||
<test.jclouds.azurecompute-arm.subscription-id>${test.jclouds.azurecompute-arm.subscription-id}</test.jclouds.azurecompute-arm.subscription-id>
|
||||
<test.jclouds.azurecompute-arm.tenant-id>${test.jclouds.azurecompute-arm.tenant-id}</test.jclouds.azurecompute-arm.tenant-id>
|
||||
<test.jclouds.oauth.resource>${test.jclouds.oauth.resource}</test.jclouds.oauth.resource>
|
||||
<test.oauth.endpoint>${test.oauth.endpoint}</test.oauth.endpoint>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -55,7 +55,6 @@ public class AzureComputeProviderMetadata extends BaseProviderMetadata {
|
||||
properties.setProperty(OPERATION_POLL_MAX_PERIOD, "15");
|
||||
properties.setProperty(TCP_RULE_FORMAT, "tcp_%s-%s");
|
||||
properties.setProperty(TCP_RULE_REGEXP, "tcp_\\d{1,5}-\\d{1,5}");
|
||||
properties.put("oauth.endpoint", "https://login.microsoftonline.com/oauth2/token");
|
||||
properties.put(RESOURCE, "https://management.azure.com");
|
||||
properties.put(CREDENTIAL_TYPE, CLIENT_CREDENTIALS_SECRET.toString());
|
||||
return properties;
|
||||
@ -69,9 +68,8 @@ public class AzureComputeProviderMetadata extends BaseProviderMetadata {
|
||||
|
||||
protected Builder() {
|
||||
super();
|
||||
|
||||
id("azurecompute-arm")
|
||||
.name("Azure Resource Management ")
|
||||
.name("Azure Resource Management")
|
||||
.apiMetadata(new AzureManagementApiMetadata())
|
||||
.endpoint("https://management.azure.com/subscriptions/SUBSCRIPTION_ID")
|
||||
.homepage(URI.create("https://www.windowsazure.com/"))
|
@ -52,6 +52,6 @@ public class AzureComputeHttpApiModule extends HttpApiModule<AzureComputeApi> {
|
||||
protected void configure() {
|
||||
install(new AzureComputeParserModule());
|
||||
super.configure();
|
||||
bind(OAuthScopes.class).toInstance(OAuthScopes.ReadOrWriteScopes.create("read", "read write"));
|
||||
bind(OAuthScopes.class).toInstance(OAuthScopes.NoScopes.create());
|
||||
}
|
||||
}
|
@ -16,20 +16,18 @@
|
||||
*/
|
||||
package org.jclouds.azurecompute.arm.internal;
|
||||
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.jclouds.oauth.v2.config.CredentialType.BEARER_TOKEN_CREDENTIALS;
|
||||
import static org.jclouds.oauth.v2.config.OAuthProperties.CREDENTIAL_TYPE;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.ContextBuilder;
|
||||
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||
import org.jclouds.azurecompute.arm.AzureComputeApi;
|
||||
import org.jclouds.azurecompute.arm.AzureComputeProviderMetadata;
|
||||
import org.jclouds.json.Json;
|
||||
import org.jclouds.rest.ApiContext;
|
||||
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
||||
@ -52,7 +50,6 @@ public class BaseAzureComputeApiMockTest {
|
||||
|
||||
protected MockWebServer server;
|
||||
protected AzureComputeApi api;
|
||||
private Json json;
|
||||
|
||||
// So that we can ignore formatting.
|
||||
private final JsonParser parser = new JsonParser();
|
||||
@ -63,15 +60,14 @@ public class BaseAzureComputeApiMockTest {
|
||||
server.play();
|
||||
Properties properties = new Properties();
|
||||
properties.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString());
|
||||
properties.put("oauth.endpoint", "https://login.microsoftonline.com/tenant-id/oauth2/token");
|
||||
AzureComputeProviderMetadata pm = AzureComputeProviderMetadata.builder().build();
|
||||
ApiContext<AzureComputeApi> ctx = ContextBuilder.newBuilder(pm)
|
||||
api = ContextBuilder.newBuilder(pm)
|
||||
.credentials("", MOCK_BEARER_TOKEN)
|
||||
.endpoint(server.getUrl("/").toString() + "subscriptions/12345678-1234-1234-1234-123456789012")
|
||||
.modules(modules)
|
||||
.overrides(properties)
|
||||
.build();
|
||||
json = ctx.utils().injector().getInstance(Json.class);
|
||||
api = ctx.getApi();
|
||||
.buildApi(AzureComputeApi.class);
|
||||
}
|
||||
|
||||
@AfterMethod(alwaysRun = true)
|
Loading…
x
Reference in New Issue
Block a user