mirror of https://github.com/apache/jclouds.git
Merge pull request #462 from danikov/vclouds-director-admin-network
Issue 830: vCloud director Admin Network
This commit is contained in:
commit
3546e2e503
|
@ -33,6 +33,7 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
|
|||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminVdcAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.GroupAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
||||
|
@ -128,7 +129,7 @@ public interface VCloudDirectorAsyncClient {
|
|||
AdminCatalogAsyncClient getAdminCatalogClient();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Group} features
|
||||
* @return asynchronous access to admin {@link Group} features
|
||||
*/
|
||||
@Delegate
|
||||
GroupAsyncClient getGroupClient();
|
||||
|
@ -150,4 +151,10 @@ public interface VCloudDirectorAsyncClient {
|
|||
*/
|
||||
@Delegate
|
||||
AdminVdcAsyncClient getAdminVdcClient();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to admin {@link Network} features
|
||||
*/
|
||||
@Delegate
|
||||
AdminNetworkAsyncClient getAdminNetworkClient();
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
|
|||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminVdcClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.GroupClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
|
||||
|
@ -132,7 +133,7 @@ public interface VCloudDirectorClient {
|
|||
AdminCatalogClient getAdminCatalogClient();
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Group} features
|
||||
* @return synchronous access to admin {@link Group} features
|
||||
*/
|
||||
@Delegate
|
||||
GroupClient getGroupClient();
|
||||
|
@ -154,4 +155,10 @@ public interface VCloudDirectorClient {
|
|||
*/
|
||||
@Delegate
|
||||
AdminVdcClient getAdminVdcClient();
|
||||
|
||||
/**
|
||||
* @return synchronous access to admin {@link Network} features
|
||||
*/
|
||||
@Delegate
|
||||
AdminNetworkClient getAdminNetworkClient();
|
||||
}
|
||||
|
|
|
@ -193,6 +193,8 @@ public class VCloudDirectorMediaType {
|
|||
|
||||
public static final String TEXT_XML = "text/xml";
|
||||
|
||||
public static final String NETWORK_POOL = "application/vnd.vmware.admin.networkPool+xml";
|
||||
|
||||
/**
|
||||
* All acceptable media types.
|
||||
*/
|
||||
|
@ -216,8 +218,7 @@ public class VCloudDirectorMediaType {
|
|||
ADMIN_ORG_NETWORK, USER, ROLE, DEPLOY_VAPP_PARAMS, RECOMPOSE_VAPP_PARAMS,
|
||||
RELOCATE_VM_PARAMS, UNDEPLOY_VAPP_PARAMS, ADMIN_VDC, MEDIA_PARAMS,
|
||||
RUNTIME_INFO_SECTION, SCREEN_TICKET, VAPP_NETWORK,
|
||||
|
||||
TEXT_XML
|
||||
TEXT_XML, ADMIN_VDC, NETWORK_POOL, ADMIN_ORG
|
||||
);
|
||||
|
||||
// NOTE These lists must be updated whenever a new media type constant is added.
|
||||
|
|
|
@ -44,6 +44,8 @@ import org.jclouds.vcloud.director.v1_5.domain.Session;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminVdcAsyncClient;
|
||||
|
@ -118,6 +120,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
|||
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class)
|
||||
.put(GroupClient.class, GroupAsyncClient.class)
|
||||
.put(UserClient.class, UserAsyncClient.class)
|
||||
.put(AdminNetworkClient.class, AdminNetworkAsyncClient.class)
|
||||
.build();
|
||||
|
||||
public VCloudDirectorRestClientModule() {
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Admin representation of external network.
|
||||
*
|
||||
*
|
||||
* <p>Java class for ExternalNetwork complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="ExternalNetwork">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}NetworkType">
|
||||
* <sequence>
|
||||
* <element name="ProviderInfo" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
||||
* </sequence>
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "ExternalNetwork")
|
||||
@XmlType(propOrder = {
|
||||
"providerInfo"
|
||||
})
|
||||
public class ExternalNetwork extends Network {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromExternalNetwork(this);
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends Network.Builder<T> {
|
||||
private String providerInfo;
|
||||
|
||||
/**
|
||||
* @see ExternalNetwork#getProviderInfo()
|
||||
*/
|
||||
public T providerInfo(String providerInfo) {
|
||||
this.providerInfo = providerInfo;
|
||||
return self();
|
||||
}
|
||||
|
||||
public ExternalNetwork build() {
|
||||
return new ExternalNetwork(this);
|
||||
}
|
||||
|
||||
public T fromExternalNetwork(ExternalNetwork in) {
|
||||
return fromNetwork(in)
|
||||
.providerInfo(in.getProviderInfo());
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private ExternalNetwork() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
private ExternalNetwork(Builder<?> b) {
|
||||
super(b);
|
||||
providerInfo = b.providerInfo;
|
||||
}
|
||||
|
||||
@XmlElement(name = "ProviderInfo", required = true)
|
||||
protected String providerInfo;
|
||||
|
||||
/**
|
||||
* Gets the value of the providerInfo property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getProviderInfo() {
|
||||
return providerInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ExternalNetwork that = ExternalNetwork.class.cast(o);
|
||||
return super.equals(that) && equal(providerInfo, that.providerInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), providerInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string()
|
||||
.add("providerInfo", providerInfo);
|
||||
}
|
||||
|
||||
}
|
|
@ -84,7 +84,6 @@ public class Link extends Reference {
|
|||
public static final String REJECT = "reject";
|
||||
public static final String RELOCATE = "relocate";
|
||||
public static final String REMOVE = "remove";
|
||||
public static final String REPAIR = "repair";
|
||||
public static final String SCREEN_ACQUIRE_TICKET = "screen:acquireTicket";
|
||||
public static final String SCREEN_THUMBNAIL = "screen:thumbnail";
|
||||
public static final String TASK_CANCEL = "task:cancel";
|
||||
|
@ -100,6 +99,7 @@ public class Link extends Reference {
|
|||
public static final String UPGRADE = "upgrade";
|
||||
public static final String UPLOAD_ALTERNATE = "upload:alternate";
|
||||
public static final String UPLOAD_DEFAULT = "upload:default";
|
||||
public static final String REPAIR = "repair";
|
||||
|
||||
/**
|
||||
* All acceptable {@link Link#getRel()} values.
|
||||
|
@ -117,7 +117,8 @@ public class Link extends Reference {
|
|||
REJECT, RELOCATE, REMOVE, REPAIR, SCREEN_ACQUIRE_TICKET,
|
||||
SCREEN_THUMBNAIL, TASK_CANCEL, BLOCKING_TASK, TASK_OWNER,
|
||||
TASK_PARAMS, TASK_REQUEST, UNDEPLOY, UNLOCK, UNREGISTER, UP,
|
||||
UPDATE_PROGRESS, UPGRADE, UPLOAD_ALTERNATE, UPLOAD_DEFAULT
|
||||
UPDATE_PROGRESS, UPGRADE, UPLOAD_ALTERNATE, UPLOAD_DEFAULT,
|
||||
UPLOAD_DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,56 +20,62 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
@XmlRootElement(name = "NetworkType")
|
||||
public class NetworkType extends EntityType {
|
||||
@XmlSeeAlso( {OrgNetwork.class, ExternalNetwork.class} )
|
||||
public abstract class Network extends EntityType {
|
||||
public static final class FenceMode {
|
||||
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return builder().fromNetworkType(this);
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
}
|
||||
|
||||
public static abstract class Builder<B extends Builder<B>> extends EntityType.Builder<B> {
|
||||
|
||||
private NetworkConfiguration networkConfiguration;
|
||||
public static final String BRIDGED = "bridged";
|
||||
public static final String ISOLATED = "isolated";
|
||||
public static final String NAT_ROUTED = "natRouted";
|
||||
|
||||
/**
|
||||
* @see NetworkType#getConfiguration()
|
||||
* All acceptable {@link Network#getFenceMode()} values.
|
||||
* <p/>
|
||||
* This list must be updated whenever a new mode is added.
|
||||
*/
|
||||
public B configuration(NetworkConfiguration networkConfiguration) {
|
||||
public static final List<String> ALL = Arrays.asList(
|
||||
BRIDGED, ISOLATED, NAT_ROUTED
|
||||
);
|
||||
}
|
||||
|
||||
public abstract static class Builder<T extends Builder<T>> extends EntityType.Builder<T> {
|
||||
protected NetworkConfiguration networkConfiguration;
|
||||
|
||||
/**
|
||||
* @see Network#getConfiguration()
|
||||
*/
|
||||
public T configuration(NetworkConfiguration networkConfiguration) {
|
||||
this.networkConfiguration = networkConfiguration;
|
||||
return self();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkType build() {
|
||||
return new NetworkType(this);
|
||||
}
|
||||
|
||||
public B fromNetworkType(NetworkType in) {
|
||||
public T fromNetwork(Network in) {
|
||||
return fromEntityType(in).configuration(in.getConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkType(Builder<?> builder) {
|
||||
super(builder);
|
||||
this.networkConfiguration = builder.networkConfiguration;
|
||||
|
||||
public Network(Builder<?> b) {
|
||||
super(b);
|
||||
networkConfiguration = b.networkConfiguration;
|
||||
}
|
||||
|
||||
protected NetworkType() {
|
||||
protected Network() {
|
||||
// for JAXB
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Network> T toSubType(Network clazz) {
|
||||
return (T)clazz;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Configuration")
|
||||
private NetworkConfiguration networkConfiguration;
|
||||
|
@ -85,18 +91,17 @@ public class NetworkType extends EntityType {
|
|||
public boolean equals(Object o) {
|
||||
if (!super.equals(o))
|
||||
return false;
|
||||
NetworkType that = NetworkType.class.cast(o);
|
||||
Network that = Network.class.cast(o);
|
||||
return super.equals(that) && equal(networkConfiguration, that.networkConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), networkConfiguration);
|
||||
return super.hashCode() + Objects.hashCode(networkConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("configuration", networkConfiguration);
|
||||
}
|
||||
|
||||
}
|
|
@ -78,7 +78,7 @@ public class NetworkConfiguration {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see NetworkConfiguration#getRetainNetInfoAcrossDeployments()
|
||||
* @see NetworkConfiguration#retainNetInfoAcrossDeployments()
|
||||
*/
|
||||
public Builder retainNetInfoAcrossDeployments(boolean retainNetInfoAcrossDeployments) {
|
||||
this.retainNetInfoAcrossDeployments = retainNetInfoAcrossDeployments;
|
||||
|
@ -115,7 +115,7 @@ public class NetworkConfiguration {
|
|||
|
||||
public Builder fromConfiguration(NetworkConfiguration in) {
|
||||
return ipScope(in.getIpScope()).parentNetwork(in.getParentNetwork()).fenceMode(in.getFenceMode())
|
||||
.retainNetInfoAcrossDeployments(in.getRetainNetInfoAcrossDeployments())
|
||||
.retainNetInfoAcrossDeployments(in.retainNetInfoAcrossDeployments())
|
||||
.features(in.getNetworkFeatures())
|
||||
.syslogServerSettings(in.getSyslogServerSettings())
|
||||
.routerInfo(in.getRouterInfo());
|
||||
|
@ -133,7 +133,7 @@ public class NetworkConfiguration {
|
|||
this.routerInfo = routerInfo;
|
||||
}
|
||||
|
||||
private NetworkConfiguration() {
|
||||
protected NetworkConfiguration() {
|
||||
// for JAXB
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ public class NetworkConfiguration {
|
|||
* @return whether the network resources such as IP/MAC of router will be retained
|
||||
* across deployments. Default is false.
|
||||
*/
|
||||
public boolean getRetainNetInfoAcrossDeployments() {
|
||||
public Boolean retainNetInfoAcrossDeployments() {
|
||||
return retainNetInfoAcrossDeployments;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,28 +27,24 @@ import com.google.common.base.Objects;
|
|||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
@XmlRootElement(name = "OrgNetwork")
|
||||
public class OrgNetwork extends NetworkType {
|
||||
|
||||
public class OrgNetwork extends Network {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<?> toBuilder() {
|
||||
return builder().fromOrgNetwork(this);
|
||||
return new ConcreteBuilder().fromOrgNetwork(this);
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
}
|
||||
|
||||
public static abstract class Builder<B extends Builder<B>> extends NetworkType.Builder<B> {
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> extends Network.Builder<T> {
|
||||
private Reference networkPool;
|
||||
private IpAddresses allowedExternalIpAddresses;
|
||||
|
||||
/**
|
||||
* @see OrgNetwork#getNetworkPool()
|
||||
*/
|
||||
public B networkPool(Reference networkPool) {
|
||||
public T networkPool(Reference networkPool) {
|
||||
this.networkPool = networkPool;
|
||||
return self();
|
||||
}
|
||||
|
@ -56,7 +52,7 @@ public class OrgNetwork extends NetworkType {
|
|||
/**
|
||||
* @see OrgNetwork#getAllowedExternalIpAddresses()
|
||||
*/
|
||||
public B allowedExternalIpAddresses(IpAddresses allowedExternalIpAddresses) {
|
||||
public T allowedExternalIpAddresses(IpAddresses allowedExternalIpAddresses) {
|
||||
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
|
||||
return self();
|
||||
}
|
||||
|
@ -65,22 +61,29 @@ public class OrgNetwork extends NetworkType {
|
|||
public OrgNetwork build() {
|
||||
return new OrgNetwork(this);
|
||||
}
|
||||
|
||||
public B fromOrgNetwork(OrgNetwork in) {
|
||||
return fromNetworkType(in).configuration(in.getConfiguration())
|
||||
|
||||
public T fromOrgNetwork(OrgNetwork in) {
|
||||
return fromEntityType(in).configuration(in.getConfiguration())
|
||||
.networkPool(in.getNetworkPool())
|
||||
.allowedExternalIpAddresses(in.getAllowedExternalIpAddresses());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
protected OrgNetwork() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
protected OrgNetwork(Builder<?> builder) {
|
||||
super(builder);
|
||||
this.networkPool = builder.networkPool;
|
||||
this.allowedExternalIpAddresses = builder.allowedExternalIpAddresses;
|
||||
private OrgNetwork(Builder<?> b) {
|
||||
super(b);
|
||||
networkPool = b.networkPool;
|
||||
allowedExternalIpAddresses = b.allowedExternalIpAddresses;
|
||||
}
|
||||
|
||||
@XmlElement(name = "NetworkPool")
|
||||
|
@ -107,18 +110,22 @@ public class OrgNetwork extends NetworkType {
|
|||
if (!super.equals(o))
|
||||
return false;
|
||||
OrgNetwork that = OrgNetwork.class.cast(o);
|
||||
return super.equals(that) && equal(networkPool, that.networkPool) &&
|
||||
return super.equals(that) &&
|
||||
equal(networkPool, that.networkPool) &&
|
||||
equal(allowedExternalIpAddresses, that.allowedExternalIpAddresses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), networkPool, allowedExternalIpAddresses);
|
||||
return Objects.hashCode(super.hashCode(),
|
||||
networkPool,
|
||||
allowedExternalIpAddresses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("networkPool", networkPool)
|
||||
return super.string()
|
||||
.add("networkPool", networkPool)
|
||||
.add("allowedExternalIpAddresses", allowedExternalIpAddresses);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,4 +232,4 @@ public class Reference {
|
|||
.href(URI.create(getHref().toASCIIString().replace(endpoint, endpoint+"/admin")))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,19 +125,20 @@ public class ResourceType {
|
|||
@XmlAttribute
|
||||
private String type;
|
||||
@XmlElement(name = "Link")
|
||||
private Set<Link> links;
|
||||
private Set<Link> links = Sets.newLinkedHashSet();
|
||||
|
||||
protected ResourceType(Builder<?> builder) {
|
||||
this.href = builder.href;
|
||||
this.type = builder.type;
|
||||
this.links = builder.links;
|
||||
this.links = builder.links == null ? Collections.<Link>emptySet() : builder.links;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ResourceType(URI href, String type, @Nullable Set<Link> links) {
|
||||
this.href = href;
|
||||
this.type = type;
|
||||
// nullable so that jaxb wont persist empty collections
|
||||
this.links = links != null && links.isEmpty() ? null : links;
|
||||
// nullable so that jaxb wont persist empty collections?
|
||||
this.links = links == null ? Collections.<Link>emptySet() : links;
|
||||
}
|
||||
|
||||
protected ResourceType() {
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
|||
* </pre>
|
||||
*/
|
||||
@XmlType(name = "VAppNetwork")
|
||||
public class VAppNetwork extends NetworkType {
|
||||
public class VAppNetwork extends Network {
|
||||
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
|
@ -48,7 +48,7 @@ public class VAppNetwork extends NetworkType {
|
|||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
}
|
||||
|
||||
public static abstract class Builder<B extends Builder<B>> extends NetworkType.Builder<B> {
|
||||
public static abstract class Builder<B extends Builder<B>> extends Network.Builder<B> {
|
||||
|
||||
private Boolean deployed;
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class VAppNetwork extends NetworkType {
|
|||
}
|
||||
|
||||
public B fromVAppNetwork(VAppNetwork in) {
|
||||
return fromNetworkType(in).isDeployed(in.isDeployed());
|
||||
return fromNetwork(in).isDeployed(in.isDeployed());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ExternalNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @see AdminNetworkClient
|
||||
* @author danikov
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||
public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
|
||||
|
||||
/**
|
||||
* @see AdminNetworkClient#getNetwork(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
@Override
|
||||
ListenableFuture<ExternalNetwork> getNetwork(@EndpointParam URI networkRef);
|
||||
|
||||
/**
|
||||
* @see AdminNetworkClient#updateNetwork(URI, OrgNetwork)
|
||||
*/
|
||||
@PUT
|
||||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> updateNetwork(@EndpointParam URI networkRef,
|
||||
@BinderParam(BindToXMLPayload.class) OrgNetwork network);
|
||||
|
||||
/**
|
||||
* @see AdminNetworkClient#resetNetwork(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/reset")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> resetNetwork(@EndpointParam URI networkRef);
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to admin {@link Network} objects.
|
||||
*
|
||||
* @see AdminNetworkAsyncClient
|
||||
* @author danikov
|
||||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface AdminNetworkClient extends NetworkClient {
|
||||
|
||||
/**
|
||||
* Gets admin representation of network. This operation could return admin
|
||||
* representation of organization network or external network. vApp networks
|
||||
* do not have admin representation.
|
||||
*
|
||||
* <pre>
|
||||
* GET /admin/network/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param networkRef the reference for the network
|
||||
* @return the network
|
||||
*/
|
||||
@Override
|
||||
Network getNetwork(URI networkRef);
|
||||
|
||||
/**
|
||||
* Modifies an org network
|
||||
*
|
||||
* <pre>
|
||||
* PUT /admin/network/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param networkRef the reference for the network
|
||||
* @param network the updated network
|
||||
* @return a task. This operation is asynchronous and the user should monitor the
|
||||
* returned task status in order to check when it is completed.
|
||||
*/
|
||||
Task updateNetwork(URI networkRef, OrgNetwork network);
|
||||
|
||||
/**
|
||||
* Reset(undeploy & redeploy) networking services on a logical network.
|
||||
* The reset operation can be performed on:
|
||||
* - external networks
|
||||
* - organization networks
|
||||
* - vApp networks
|
||||
* The reset operation can be performed only on deployed networks.
|
||||
*
|
||||
* <pre>
|
||||
* POST /admin/network/{id}/action/reset
|
||||
* </pre>
|
||||
*
|
||||
* @param networkRef the reference for the network
|
||||
* @return a task. This operation is asynchronous and the user should monitor the
|
||||
* returned task status in order to check when it is completed.
|
||||
*/
|
||||
Task resetNetwork(URI networkRef);
|
||||
|
||||
}
|
|
@ -29,7 +29,7 @@ import org.jclouds.rest.annotations.ExceptionParser;
|
|||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public interface NetworkAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam URI networkUri);
|
||||
ListenableFuture<? extends Network> getNetwork(@EndpointParam URI networkUri);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Network;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Network.
|
||||
|
@ -42,7 +42,7 @@ public interface NetworkClient {
|
|||
*
|
||||
* @return the network or null if not found
|
||||
*/
|
||||
OrgNetwork getNetwork(URI networkUri);
|
||||
Network getNetwork(URI networkUri);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.testng;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -104,7 +106,9 @@ public class FormatApiResultsListener implements ITestListener {
|
|||
}
|
||||
|
||||
private String getOperation(ITestResult res) {
|
||||
return res.getMethod().getConstructorOrMethod().getMethod().getAnnotation(Test.class).testName();
|
||||
Method method = res.getMethod().getConstructorOrMethod().getMethod();
|
||||
Test test = method.getAnnotation(Test.class);
|
||||
return test != null ? test.testName() : method.getName();
|
||||
}
|
||||
|
||||
private String getDuration() {
|
||||
|
|
|
@ -56,7 +56,6 @@ import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.ovf.Disk;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
|
||||
|
@ -360,7 +359,7 @@ public class Checks {
|
|||
"The Image type of a Media must be one of the allowed list");
|
||||
}
|
||||
|
||||
public static void checkNetworkType(NetworkType network) {
|
||||
public static void checkNetwork(Network network) {
|
||||
// Check optional fields
|
||||
NetworkConfiguration config = network.getConfiguration();
|
||||
if (config != null) {
|
||||
|
@ -372,7 +371,14 @@ public class Checks {
|
|||
}
|
||||
|
||||
public static void checkNetworkConfiguration(NetworkConfiguration config) {
|
||||
// required
|
||||
assertNotNull(config.getFenceMode(), String.format(OBJ_FIELD_REQ,
|
||||
"NetworkConfiguration", "fenceMode"));
|
||||
assertTrue(Network.FenceMode.ALL.contains(config.getFenceMode()), String.format(REQUIRED_VALUE_OBJECT_FMT,
|
||||
"fenceMode", "NetworkConfiguration", config.getFenceMode(), Iterables.toString(Network.FenceMode.ALL)));
|
||||
|
||||
// Check optional fields
|
||||
// NOTE retainNetInfoAcrossDeployments cannot be checked
|
||||
if (config.getIpScope() != null) {
|
||||
checkIpScope(config.getIpScope());
|
||||
}
|
||||
|
@ -1113,7 +1119,7 @@ public class Checks {
|
|||
|
||||
// Check optional fields
|
||||
if (section.getNetworks() != null) {
|
||||
for (Network network : section.getNetworks()) {
|
||||
for (org.jclouds.vcloud.director.v1_5.domain.ovf.Network network : section.getNetworks()) {
|
||||
checkNetwork(network);
|
||||
}
|
||||
}
|
||||
|
@ -1122,7 +1128,7 @@ public class Checks {
|
|||
checkOvfSectionType(section);
|
||||
}
|
||||
|
||||
public static void checkNetwork(Network network) {
|
||||
public static void checkNetwork(org.jclouds.vcloud.director.v1_5.domain.ovf.Network network) {
|
||||
assertNotNull(network, String.format(NOT_NULL_OBJ_FMT, "Network"));
|
||||
|
||||
// Check optional fields
|
||||
|
@ -1269,7 +1275,7 @@ public class Checks {
|
|||
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "NetworkSection"));
|
||||
|
||||
if (val.getNetworks() != null) {
|
||||
for (Network network : val.getNetworks()) {
|
||||
for (org.jclouds.vcloud.director.v1_5.domain.ovf.Network network : val.getNetworks()) {
|
||||
checkOvfNetwork(network);
|
||||
}
|
||||
}
|
||||
|
@ -1277,7 +1283,7 @@ public class Checks {
|
|||
checkOvfSectionType(val);
|
||||
}
|
||||
|
||||
private static void checkOvfNetwork(Network val) {
|
||||
private static void checkOvfNetwork(org.jclouds.vcloud.director.v1_5.domain.ovf.Network val) {
|
||||
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Network"));
|
||||
}
|
||||
|
||||
|
@ -1367,6 +1373,30 @@ public class Checks {
|
|||
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "ResouorceAllocatoinSettingData"));
|
||||
}
|
||||
|
||||
public static void checkOrgNetwork(OrgNetwork network) {
|
||||
// optional
|
||||
Reference networkPoolRef = network.getNetworkPool();
|
||||
if (networkPoolRef != null) {
|
||||
Checks.checkReferenceType(networkPoolRef);
|
||||
}
|
||||
IpAddresses allowedExternalIpAddresses = network.getAllowedExternalIpAddresses();
|
||||
if (allowedExternalIpAddresses != null) {
|
||||
Checks.checkIpAddresses(allowedExternalIpAddresses);
|
||||
}
|
||||
|
||||
// parent type
|
||||
checkNetwork(network);
|
||||
}
|
||||
|
||||
public static void checkExternalNetwork(ExternalNetwork network) {
|
||||
// required
|
||||
assertNotNull(network.getProviderInfo(), String.format(OBJ_FIELD_REQ,
|
||||
"ExternalNetwork", "providerInfo"));
|
||||
|
||||
// parent type
|
||||
checkNetwork(network);
|
||||
}
|
||||
|
||||
public static void checkAdminVdc(AdminVdc vdc) {
|
||||
// optional
|
||||
// NOTE isThinProvision cannot be checked
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Test the {@link GroupClient} by observing its side effects.
|
||||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@Test(groups = { "unit", "admin", "adminNetwork"}, singleThreaded = true, testName = "AdminNetworkClientExpectTest")
|
||||
public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
Reference networkRef = Reference.builder()
|
||||
.href(URI.create(endpoint+"/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1"))
|
||||
.build();
|
||||
|
||||
@Test
|
||||
public void testGetNetworkWithOrgNetwork() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/admin/orgNetwork.xml", VCloudDirectorMediaType.ORG_NETWORK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
OrgNetwork expected = orgNetwork();
|
||||
|
||||
assertEquals(client.getAdminNetworkClient().getNetwork(networkRef.getHref()), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateNetwork() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")
|
||||
.xmlFilePayload("/network/admin/updateNetworkSource.xml", VCloudDirectorMediaType.ORG_NETWORK)
|
||||
.acceptMedia(VCloudDirectorMediaType.TASK)
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/admin/updateNetworkTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Task expected = updateNetworkTask();
|
||||
|
||||
assertEquals(client.getAdminNetworkClient().updateNetwork(networkRef.getHref(), updateNetwork()), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testResetNetwork() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("POST", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1/action/reset")
|
||||
.acceptMedia(VCloudDirectorMediaType.TASK)
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/admin/resetNetworkTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Task expected = resetNetworkTask();
|
||||
|
||||
assertEquals(client.getAdminNetworkClient().resetNetwork(networkRef.getHref()), expected);
|
||||
}
|
||||
|
||||
public final OrgNetwork orgNetwork() {
|
||||
return NetworkClientExpectTest.orgNetwork().toBuilder()
|
||||
.href(toAdminUri(NetworkClientExpectTest.orgNetwork().getHref()))
|
||||
.links(ImmutableSet.of(
|
||||
Link.builder()
|
||||
.rel("alternate")
|
||||
.type("application/vnd.vmware.vcloud.orgNetwork+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
|
||||
.build(),
|
||||
Link.builder()
|
||||
.rel("edit")
|
||||
.type("application/vnd.vmware.admin.orgNetwork+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
|
||||
.build(),
|
||||
Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.admin.organization+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build(),
|
||||
Link.builder()
|
||||
.rel("repair")
|
||||
.type("application/vnd.vmware.admin.orgNetwork+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/action/reset"))
|
||||
.build(),
|
||||
Link.builder()
|
||||
.rel("down")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/metadata"))
|
||||
.build()))
|
||||
.networkPool(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.networkPool+xml")
|
||||
.name("vcdni01")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/extension/networkPool/e86bfdb5-b3e0-4ece-9125-e764ac64c95c"))
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
public final OrgNetwork updateNetwork() {
|
||||
return orgNetwork().toBuilder()
|
||||
|
||||
.build();
|
||||
}
|
||||
|
||||
public final Task resetNetworkTask() {
|
||||
return Task.builder()
|
||||
|
||||
.build();
|
||||
}
|
||||
|
||||
public final Task updateNetworkTask() {
|
||||
return Task.builder()
|
||||
.status("running")
|
||||
.startTime(dateService.iso8601DateParse("2012-03-14T12:39:23.720-04:00"))
|
||||
.operationName("networkUpdateNetwork")
|
||||
.operation("Updating Network ilsolation01-Jclouds(f3ba8256-6f48-4512-aad6-600e85b4dc38)")
|
||||
.expiryTime(dateService.iso8601DateParse("2012-06-12T12:39:23.720-04:00"))
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:49d2e180-7921-4902-ac39-b4ff5406bb94")
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94"))
|
||||
.link(Link.builder()
|
||||
.rel("task:cancel")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94/action/cancel"))
|
||||
.build())
|
||||
.owner(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.network+xml")
|
||||
.name("ilsolation01-Jclouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
|
||||
.build())
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("dan@cloudsoftcorp.com")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"))
|
||||
.build())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REQUIRED_VALUE_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.TASK_COMPLETE_TIMELY;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ExternalNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpScope;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkConfiguration;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkFeatures;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.RouterInfo;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link AdminNetworkClient}.
|
||||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@Test(groups = { "live", "admin", "network" }, singleThreaded = true, testName = "AdminNetworkLiveTest")
|
||||
public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
public static final String NETWORK = "AdminNetwork";
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
private AdminNetworkClient networkClient;
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
Reference networkRef;
|
||||
Network network;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
protected void setupRequiredClients() {
|
||||
networkClient = context.getApi().getAdminNetworkClient();
|
||||
networkRef = Reference.builder().href(networkURI).build().toAdminReference(endpoint);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /admin/network/{id}")
|
||||
public void testGetNetwork() {
|
||||
//TODO: test both org and external networks
|
||||
assertNotNull(networkRef, String.format(OBJ_REQ_LIVE, NETWORK));
|
||||
network = networkClient.getNetwork(networkRef.getHref());
|
||||
|
||||
if(network instanceof ExternalNetwork) {
|
||||
Checks.checkExternalNetwork(Network.<ExternalNetwork>toSubType(network));
|
||||
} else if (network instanceof OrgNetwork) {
|
||||
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
|
||||
} else {
|
||||
fail(String.format(REQUIRED_VALUE_OBJECT_FMT, ".class", NETWORK,
|
||||
network.getClass(),"ExternalNetwork,. OrgNetwork"));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this test is far from exhaustive
|
||||
@Test(testName = "PUT /admin/network/{id}" )
|
||||
public void testUpdateNetwork() {
|
||||
//TODO: ensure network instanceof OrgNetwork, may require queries
|
||||
assertTrue(network instanceof OrgNetwork, String.format(REF_REQ_LIVE, "OrgNetwork"));
|
||||
|
||||
OrgNetwork oldNetwork = Network.<OrgNetwork>toSubType(network).toBuilder()
|
||||
.tasks(null)
|
||||
.build();
|
||||
|
||||
OrgNetwork updateNetwork = getMutatedOrgNetwork(oldNetwork);
|
||||
|
||||
try {
|
||||
Task updateNetworkTask = networkClient.updateNetwork(network.getHref(), updateNetwork);
|
||||
Checks.checkTask(updateNetworkTask);
|
||||
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask"));
|
||||
network = networkClient.getNetwork(network.getHref());
|
||||
|
||||
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
|
||||
|
||||
assertTrue(equal(network.getConfiguration().getIpScope(),
|
||||
updateNetwork.getConfiguration().getIpScope()),
|
||||
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "ipScope"));
|
||||
assertTrue(equal(network.getConfiguration().getParentNetwork(),
|
||||
updateNetwork.getConfiguration().getParentNetwork()),
|
||||
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "parentNetwork"));
|
||||
assertTrue(equal(network.getConfiguration().getFenceMode(),
|
||||
updateNetwork.getConfiguration().getFenceMode()),
|
||||
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "fenceMode"));
|
||||
assertTrue(equal(network.getConfiguration().retainNetInfoAcrossDeployments(),
|
||||
updateNetwork.getConfiguration().retainNetInfoAcrossDeployments()),
|
||||
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "retainNetInfoAcrossDeployments"));
|
||||
assertTrue(equal(network.getConfiguration().getNetworkFeatures(),
|
||||
updateNetwork.getConfiguration().getNetworkFeatures()),
|
||||
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "networkFeatures"));
|
||||
assertTrue(equal(network.getConfiguration().getSyslogServerSettings(),
|
||||
updateNetwork.getConfiguration().getSyslogServerSettings()),
|
||||
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "syslogServerSettings"));
|
||||
assertTrue(equal(network.getConfiguration().getRouterInfo(),
|
||||
updateNetwork.getConfiguration().getRouterInfo()),
|
||||
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "routerInfo"));
|
||||
// FIXME: fails
|
||||
// assertTrue(equal(Network.<OrgNetwork>toSubType(network).getNetworkPool(),
|
||||
// updateNetwork.getNetworkPool()),
|
||||
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "networkPool"));
|
||||
|
||||
// assertTrue(equal(Network.<OrgNetwork>toSubType(network).getAllowedExternalIpAddresses(),
|
||||
// updateNetwork.getAllowedExternalIpAddresses()),
|
||||
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "allowedExternalIpAddresses"));
|
||||
} finally {
|
||||
Task updateNetworkTask = networkClient.updateNetwork(network.getHref(), oldNetwork);
|
||||
Checks.checkTask(updateNetworkTask);
|
||||
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask"));
|
||||
network = networkClient.getNetwork(network.getHref());
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "POST /admin/network/{id}/action/reset")
|
||||
public void testResetNetwork() {
|
||||
// TODO assert that network is deployed somehow
|
||||
Task resetNetworkTask = networkClient.resetNetwork(network.getHref());
|
||||
Checks.checkTask(resetNetworkTask);
|
||||
assertTrue(retryTaskSuccess.apply(resetNetworkTask), String.format(TASK_COMPLETE_TIMELY, "resetNetworkTask"));
|
||||
network = networkClient.getNetwork(network.getHref());
|
||||
|
||||
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
|
||||
// TODO: other assertions about the reset? that network is deployed when task is complete, for example
|
||||
}
|
||||
|
||||
private static OrgNetwork getMutatedOrgNetwork(OrgNetwork network) {
|
||||
OrgNetwork.Builder<?> networkBuilder = OrgNetwork.builder().fromNetwork(network)
|
||||
.tasks(null)
|
||||
// .name("new "+network.getName())
|
||||
.description("new "+network.getDescription())
|
||||
.configuration(getMutatedNetworkConfiguration(network.getConfiguration()));
|
||||
|
||||
// FIXME: fails
|
||||
// if (network.getNetworkPool() != null) {
|
||||
// networkBuilder.networkPool(null);
|
||||
// } // TODO: else?
|
||||
|
||||
// if (network.getAllowedExternalIpAddresses() != null) {
|
||||
// networkBuilder.allowedExternalIpAddresses(null);
|
||||
// } // TODO: else?
|
||||
|
||||
return networkBuilder.build();
|
||||
}
|
||||
|
||||
private static NetworkConfiguration getMutatedNetworkConfiguration(NetworkConfiguration config) {
|
||||
NetworkConfiguration.Builder configBuilder = config.toBuilder();
|
||||
|
||||
if (config.getIpScope() != null) {
|
||||
configBuilder.ipScope(IpScope.builder().fromIpScope(config.getIpScope())
|
||||
// TODO: mutate to test more
|
||||
.build());
|
||||
}
|
||||
|
||||
if (config.getParentNetwork() != null) {
|
||||
// configBuilder.parentNetwork(null);
|
||||
} // TODO: else?
|
||||
|
||||
// configBuilder.fenceMode(config.getFenceMode() == Network.FenceMode.BRIDGED ?
|
||||
// Network.FenceMode.BRIDGED : Network.FenceMode.ISOLATED);
|
||||
|
||||
if (config.getSyslogServerSettings() != null) {
|
||||
configBuilder.syslogServerSettings(SyslogServerSettings.builder()
|
||||
.fromSyslogServerSettings(config.getSyslogServerSettings())
|
||||
// TODO: mutate to test more
|
||||
.build());
|
||||
}
|
||||
|
||||
if (config.retainNetInfoAcrossDeployments() != null) {
|
||||
// configBuilder.retainNetInfoAcrossDeployments(!config.retainNetInfoAcrossDeployments());
|
||||
} else {
|
||||
// configBuilder.retainNetInfoAcrossDeployments(false);
|
||||
}
|
||||
|
||||
if (config.getNetworkFeatures() != null) {
|
||||
configBuilder.features(NetworkFeatures.builder().fromNetworkFeatures(config.getNetworkFeatures())
|
||||
// TODO: mutate to test more
|
||||
.build());
|
||||
}
|
||||
|
||||
if (config.getRouterInfo() != null) {
|
||||
configBuilder.routerInfo(RouterInfo.builder().fromRouterInfo(config.getRouterInfo())
|
||||
// TODO: mutate to test more
|
||||
.build());
|
||||
}
|
||||
|
||||
return configBuilder.build();
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ import java.net.URI;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.DhcpService;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Error;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpAddresses;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpRange;
|
||||
|
@ -34,7 +35,10 @@ import org.jclouds.vcloud.director.v1_5.domain.IpScope;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkConfiguration;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkFeatures;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
|
@ -51,30 +55,40 @@ import com.google.common.collect.ImmutableSet;
|
|||
public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs2xxLoginReturnsValidNetwork() {
|
||||
URI networkUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c");
|
||||
public void testGetNetwork() {
|
||||
URI networkUri = URI.create(endpoint + "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c"),
|
||||
getStandardPayloadResponse("/network/network.xml", VCloudDirectorMediaType.ORG_NETWORK));
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/network.xml", VCloudDirectorMediaType.ORG_NETWORK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
OrgNetwork expected = orgNetwork();
|
||||
assertEquals(client.getNetworkClient().getNetwork(networkUri), expected);
|
||||
assertEquals(Network.<OrgNetwork>toSubType(client.getNetworkClient().getNetwork(networkUri)), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs400ForInvalidNetworkId() {
|
||||
public void testGetNetworkWithInvalidId() {
|
||||
URI networkUri = URI.create(endpoint + "/network/NOTAUUID");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/network/NOTAUUID"),
|
||||
getStandardPayloadResponse(400, "/network/error400.xml", VCloudDirectorMediaType.ERROR));
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/network/NOTAUUID")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/error400.xml", VCloudDirectorMediaType.ERROR)
|
||||
.httpResponseBuilder().statusCode(400).build());
|
||||
|
||||
Error expected = Error.builder()
|
||||
.message("validation error : EntityRef has incorrect type, expected type is com.vmware.vcloud.entity.network.")
|
||||
.majorErrorCode(400)
|
||||
.minorErrorCode("BAD_REQUEST")
|
||||
.build();
|
||||
.message("validation error : EntityRef has incorrect type, expected type is com.vmware.vcloud.entity.network.")
|
||||
.majorErrorCode(400)
|
||||
.minorErrorCode("BAD_REQUEST")
|
||||
.build();
|
||||
|
||||
try {
|
||||
client.getNetworkClient().getNetwork(networkUri);
|
||||
|
@ -87,18 +101,23 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs403ForCatalogIdUsedAsNetworkId() {
|
||||
public void testGetNetworkWithCatalogId() {
|
||||
URI networkUri = URI.create(endpoint + "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"),
|
||||
getStandardPayloadResponse(403, "/network/error403-catalog.xml", VCloudDirectorMediaType.ERROR));
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/error403-catalog.xml", VCloudDirectorMediaType.ERROR)
|
||||
.httpResponseBuilder().statusCode(403).build());
|
||||
|
||||
Error expected = Error.builder()
|
||||
.message("This operation is denied.")
|
||||
.majorErrorCode(403)
|
||||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
.message("This operation is denied.")
|
||||
.majorErrorCode(403)
|
||||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
try {
|
||||
client.getNetworkClient().getNetwork(networkUri);
|
||||
|
@ -111,18 +130,23 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs403ForFakeNetworkId() {
|
||||
public void testGetNetworkWithFakeId() {
|
||||
URI networkUri = URI.create(endpoint + "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"),
|
||||
getStandardPayloadResponse(403, "/network/error403-fake.xml", VCloudDirectorMediaType.ERROR));
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/error403-fake.xml", VCloudDirectorMediaType.ERROR)
|
||||
.httpResponseBuilder().statusCode(403).build());
|
||||
|
||||
Error expected = Error.builder()
|
||||
.message("This operation is denied.")
|
||||
.majorErrorCode(403)
|
||||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
.message("This operation is denied.")
|
||||
.majorErrorCode(403)
|
||||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
try {
|
||||
client.getNetworkClient().getNetwork(networkUri);
|
||||
|
@ -135,83 +159,105 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs2xxLoginReturnsValidMetadataList() {
|
||||
public void testGetMetadata() {
|
||||
URI networkUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/metadata.xml", VCloudDirectorMediaType.METADATA)
|
||||
.httpResponseBuilder().build());
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/metadata.xml", VCloudDirectorMediaType.METADATA)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Metadata expected = Metadata.builder()
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.network+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c"))
|
||||
.build())
|
||||
.entries(ImmutableSet.of(MetadataEntry.builder().entry("key", "value").build()))
|
||||
.build();
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.network+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c"))
|
||||
.build())
|
||||
.entries(ImmutableSet.of(MetadataEntry.builder().entry("key", "value").build()))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getNetworkClient().getMetadataClient().getMetadata(networkUri), expected);
|
||||
}
|
||||
|
||||
@Test(enabled=false) // No metadata in exemplar xml...
|
||||
public void testWhenResponseIs2xxLoginReturnsValidMetadata() {
|
||||
@Test
|
||||
public void testGetMetadataValue() {
|
||||
URI networkUri = URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY"),
|
||||
getStandardPayloadResponse("/network/metadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/network/metadataValue.xml", VCloudDirectorMediaType.METADATA_ENTRY)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
MetadataEntry expected = MetadataEntry.builder()
|
||||
.entry("key", "value")
|
||||
.build();
|
||||
MetadataValue expected = MetadataValue.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/key"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata"))
|
||||
.build())
|
||||
.value("value")
|
||||
.build();
|
||||
|
||||
assertEquals(client.getNetworkClient().getMetadataClient().getMetadataValue(networkUri, "KEY"), expected);
|
||||
}
|
||||
|
||||
|
||||
public static OrgNetwork orgNetwork() {
|
||||
return OrgNetwork.builder()
|
||||
.name("internet01-Jclouds")
|
||||
.id("urn:vcloud:network:55a677cf-ab3f-48ae-b880-fab90421980c")
|
||||
.type(VCloudDirectorMediaType.ORG_NETWORK)
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.name("ilsolation01-Jclouds")
|
||||
.id("urn:vcloud:network:f3ba8256-6f48-4512-aad6-600e85b4dc38")
|
||||
.type("application/vnd.vmware.vcloud.orgNetwork+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("down")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/metadata"))
|
||||
.build())
|
||||
.description("")
|
||||
.configuration(NetworkConfiguration.builder()
|
||||
.ipScope(IpScope.builder()
|
||||
.isInherited(false)
|
||||
.gateway("192.168.1.1")
|
||||
.netmask("255.255.255.0")
|
||||
.dns1("173.240.111.52")
|
||||
.dns2("173.240.111.53")
|
||||
.ipRanges(IpRanges.builder()
|
||||
.ipRange(IpRange.builder()
|
||||
.startAddress("192.168.1.100")
|
||||
.endAddress("192.168.1.199")
|
||||
.build())
|
||||
.build())
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("down")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata"))
|
||||
.build())
|
||||
.description("")
|
||||
.configuration(NetworkConfiguration.builder()
|
||||
.ipScope(IpScope.builder()
|
||||
.isInherited(true)
|
||||
.gateway("173.240.107.49")
|
||||
.netmask("255.255.255.240")
|
||||
.dns1("173.240.111.52")
|
||||
.dns2("173.240.111.53")
|
||||
.ipRanges(IpRanges.builder()
|
||||
.ipRange(IpRange.builder()
|
||||
.startAddress("173.240.107.50")
|
||||
.endAddress("173.240.107.62")
|
||||
.build())
|
||||
.build())
|
||||
.fenceMode("isolated")
|
||||
.retainNetInfoAcrossDeployments(false)
|
||||
.features(NetworkFeatures.builder()
|
||||
.service(DhcpService.builder()
|
||||
.enabled(false)
|
||||
.defaultLeaseTime(3600)
|
||||
.maxLeaseTime(7200)
|
||||
.ipRange(IpRange.builder()
|
||||
.startAddress("192.168.1.2")
|
||||
.endAddress("192.168.1.99")
|
||||
.build())
|
||||
.build())
|
||||
.fenceMode("bridged")
|
||||
.retainNetInfoAcrossDeployments(false)
|
||||
.syslogServerSettings(SyslogServerSettings.builder().build())
|
||||
.build())
|
||||
.allowedExternalIpAddresses(IpAddresses.builder().build())
|
||||
.build();
|
||||
.syslogServerSettings(SyslogServerSettings.builder().build())
|
||||
.build())
|
||||
.allowedExternalIpAddresses(IpAddresses.builder().build())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.O
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REQUIRED_VALUE_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceType;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
@ -30,10 +31,10 @@ import static org.testng.Assert.assertNotNull;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpAddresses;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
|
@ -62,29 +63,20 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
public void setupRequiredClients() {
|
||||
networkClient = context.getApi().getNetworkClient();
|
||||
}
|
||||
|
||||
|
||||
@Test(testName = "GET /network/{id}")
|
||||
public void testGetNetwork() {
|
||||
// required for testing
|
||||
assertNotNull(networkURI, String.format(REF_REQ_LIVE, NETWORK));
|
||||
|
||||
OrgNetwork network = networkClient.getNetwork(networkURI);
|
||||
Network abstractNetwork = networkClient.getNetwork(networkURI);
|
||||
assertTrue(abstractNetwork instanceof OrgNetwork, String.format(REQUIRED_VALUE_OBJECT_FMT,
|
||||
".class", NETWORK, abstractNetwork.getClass(),"OrgNetwork"));
|
||||
OrgNetwork network = Network.toSubType(abstractNetwork);
|
||||
assertNotNull(network, String.format(OBJ_REQ_LIVE, NETWORK));
|
||||
assertTrue(!network.getDescription().equals("DO NOT USE"), "Network isn't to be used for testing");
|
||||
|
||||
// parent type
|
||||
Checks.checkNetworkType(network);
|
||||
|
||||
// optional
|
||||
Reference networkPoolRef = network.getNetworkPool();
|
||||
if (networkPoolRef != null) {
|
||||
Checks.checkReferenceType(networkPoolRef);
|
||||
}
|
||||
|
||||
IpAddresses allowedExternalIpAddresses = network.getAllowedExternalIpAddresses();
|
||||
if (allowedExternalIpAddresses != null) {
|
||||
Checks.checkIpAddresses(allowedExternalIpAddresses);
|
||||
}
|
||||
Checks.checkOrgNetwork(network);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /network/{id}/metadata")
|
||||
|
|
|
@ -85,14 +85,14 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
|||
}
|
||||
|
||||
// NOTE Implement as required to populate xxxClient fields, or NOP
|
||||
public abstract void setupRequiredClients() throws Exception;
|
||||
protected abstract void setupRequiredClients() throws Exception;
|
||||
|
||||
public Predicate<Task> retryTaskSuccess;
|
||||
public Predicate<Task> retryTaskSuccessLong;
|
||||
|
||||
@Inject
|
||||
protected void initTaskSuccess(TaskSuccess taskSuccess) {
|
||||
retryTaskSuccess = new RetryablePredicate<Task>(taskSuccess, TASK_TIMEOUT_SECONDS * 1000L);
|
||||
retryTaskSuccess = new RetryablePredicate<Task>(taskSuccess, TASK_TIMEOUT_SECONDS * 10000L);
|
||||
}
|
||||
|
||||
@Inject
|
||||
|
@ -104,7 +104,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
|||
protected Session session;
|
||||
|
||||
@BeforeClass(groups = { "live" })
|
||||
public void setupContext() throws Exception {
|
||||
protected void setupContext() throws Exception {
|
||||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.jclouds.http.HttpResponse;
|
|||
import org.jclouds.rest.BaseRestClientExpectTest;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
@ -241,4 +242,12 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
|||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
public URI toAdminUri(Reference ref) {
|
||||
return toAdminUri(ref.getHref());
|
||||
}
|
||||
|
||||
public URI toAdminUri(URI uri) {
|
||||
return Reference.builder().href(uri).build().toAdminReference(endpoint).getHref();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1.5" name="ilsolation01-Jclouds" id="urn:vcloud:network:f3ba8256-6f48-4512-aad6-600e85b4dc38" type="application/vnd.vmware.vcloud.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.admin.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"/>
|
||||
<Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
<Link rel="repair" type="application/vnd.vmware.admin.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/action/reset"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/metadata"/>
|
||||
<Description/>
|
||||
<Configuration>
|
||||
<IpScope>
|
||||
<IsInherited>false</IsInherited>
|
||||
<Gateway>192.168.1.1</Gateway>
|
||||
<Netmask>255.255.255.0</Netmask>
|
||||
<Dns1>173.240.111.52</Dns1>
|
||||
<Dns2>173.240.111.53</Dns2>
|
||||
<IpRanges>
|
||||
<IpRange>
|
||||
<StartAddress>192.168.1.100</StartAddress>
|
||||
<EndAddress>192.168.1.199</EndAddress>
|
||||
</IpRange>
|
||||
</IpRanges>
|
||||
</IpScope>
|
||||
<FenceMode>isolated</FenceMode>
|
||||
<RetainNetInfoAcrossDeployments>false</RetainNetInfoAcrossDeployments>
|
||||
<Features>
|
||||
<DhcpService>
|
||||
<IsEnabled>false</IsEnabled>
|
||||
<DefaultLeaseTime>3600</DefaultLeaseTime>
|
||||
<MaxLeaseTime>7200</MaxLeaseTime>
|
||||
<IpRange>
|
||||
<StartAddress>192.168.1.2</StartAddress>
|
||||
<EndAddress>192.168.1.99</EndAddress>
|
||||
</IpRange>
|
||||
</DhcpService>
|
||||
</Features>
|
||||
<SyslogServerSettings/>
|
||||
</Configuration>
|
||||
<NetworkPool type="application/vnd.vmware.admin.networkPool+xml" name="vcdni01" href="https://vcloudbeta.bluelock.com/api/admin/extension/networkPool/e86bfdb5-b3e0-4ece-9125-e764ac64c95c"/>
|
||||
<AllowedExternalIpAddresses/>
|
||||
</OrgNetwork>
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<OrgNetwork name="ilsolation01-Jclouds" id="urn:vcloud:network:f3ba8256-6f48-4512-aad6-600e85b4dc38" type="application/vnd.vmware.vcloud.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38" xmlns="http://www.vmware.com/vcloud/v1.5">
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.admin.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"/>
|
||||
<Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
<Link rel="repair" type="application/vnd.vmware.admin.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/action/reset"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/metadata"/>
|
||||
<Description></Description>
|
||||
<Configuration>
|
||||
<IpScope>
|
||||
<IsInherited>false</IsInherited>
|
||||
<Gateway>192.168.1.1</Gateway>
|
||||
<Netmask>255.255.255.0</Netmask>
|
||||
<Dns1>173.240.111.52</Dns1>
|
||||
<Dns2>173.240.111.53</Dns2>
|
||||
<IpRanges>
|
||||
<IpRange>
|
||||
<StartAddress>192.168.1.100</StartAddress>
|
||||
<EndAddress>192.168.1.199</EndAddress>
|
||||
</IpRange>
|
||||
</IpRanges>
|
||||
</IpScope>
|
||||
<FenceMode>isolated</FenceMode>
|
||||
<RetainNetInfoAcrossDeployments>false</RetainNetInfoAcrossDeployments>
|
||||
<Features>
|
||||
<DhcpService>
|
||||
<IsEnabled>false</IsEnabled>
|
||||
<DefaultLeaseTime>3600</DefaultLeaseTime>
|
||||
<MaxLeaseTime>7200</MaxLeaseTime>
|
||||
<IpRange>
|
||||
<StartAddress>192.168.1.2</StartAddress>
|
||||
<EndAddress>192.168.1.99</EndAddress>
|
||||
</IpRange>
|
||||
</DhcpService>
|
||||
</Features>
|
||||
<SyslogServerSettings/>
|
||||
</Configuration>
|
||||
<NetworkPool type="application/vnd.vmware.admin.networkPool+xml" name="vcdni01" href="https://vcloudbeta.bluelock.com/api/admin/extension/networkPool/e86bfdb5-b3e0-4ece-9125-e764ac64c95c"/>
|
||||
<AllowedExternalIpAddresses/>
|
||||
</OrgNetwork>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Task xmlns="http://www.vmware.com/vcloud/v1.5" status="running" startTime="2012-03-14T12:39:23.720-04:00" operationName="networkUpdateNetwork" operation="Updating Network ilsolation01-Jclouds(f3ba8256-6f48-4512-aad6-600e85b4dc38)" expiryTime="2012-06-12T12:39:23.720-04:00" name="task" id="urn:vcloud:task:49d2e180-7921-4902-ac39-b4ff5406bb94" type="application/vnd.vmware.vcloud.task+xml" href="https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="task:cancel" href="https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94/action/cancel"/>
|
||||
<Owner type="application/vnd.vmware.vcloud.network+xml" name="ilsolation01-Jclouds" href="https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"/>
|
||||
<User type="application/vnd.vmware.admin.user+xml" name="dan@cloudsoftcorp.com" href="https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"/>
|
||||
<Organization type="application/vnd.vmware.vcloud.org+xml" name="JClouds" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
</Task>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/key" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata"/>
|
||||
<Value>value</Value>
|
||||
</MetadataValue>
|
|
@ -1,25 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1.5" name="internet01-Jclouds" id="urn:vcloud:network:55a677cf-ab3f-48ae-b880-fab90421980c" type="application/vnd.vmware.vcloud.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1.5" name="ilsolation01-Jclouds" id="urn:vcloud:network:f3ba8256-6f48-4512-aad6-600e85b4dc38" type="application/vnd.vmware.vcloud.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/metadata"/>
|
||||
<Description/>
|
||||
<Configuration>
|
||||
<IpScope>
|
||||
<IsInherited>true</IsInherited>
|
||||
<Gateway>173.240.107.49</Gateway>
|
||||
<Netmask>255.255.255.240</Netmask>
|
||||
<IsInherited>false</IsInherited>
|
||||
<Gateway>192.168.1.1</Gateway>
|
||||
<Netmask>255.255.255.0</Netmask>
|
||||
<Dns1>173.240.111.52</Dns1>
|
||||
<Dns2>173.240.111.53</Dns2>
|
||||
<IpRanges>
|
||||
<IpRange>
|
||||
<StartAddress>173.240.107.50</StartAddress>
|
||||
<EndAddress>173.240.107.62</EndAddress>
|
||||
<StartAddress>192.168.1.100</StartAddress>
|
||||
<EndAddress>192.168.1.199</EndAddress>
|
||||
</IpRange>
|
||||
</IpRanges>
|
||||
</IpScope>
|
||||
<FenceMode>bridged</FenceMode>
|
||||
<FenceMode>isolated</FenceMode>
|
||||
<RetainNetInfoAcrossDeployments>false</RetainNetInfoAcrossDeployments>
|
||||
<Features>
|
||||
<DhcpService>
|
||||
<IsEnabled>false</IsEnabled>
|
||||
<DefaultLeaseTime>3600</DefaultLeaseTime>
|
||||
<MaxLeaseTime>7200</MaxLeaseTime>
|
||||
<IpRange>
|
||||
<StartAddress>192.168.1.2</StartAddress>
|
||||
<EndAddress>192.168.1.99</EndAddress>
|
||||
</IpRange>
|
||||
</DhcpService>
|
||||
</Features>
|
||||
<SyslogServerSettings/>
|
||||
</Configuration>
|
||||
<AllowedExternalIpAddresses/>
|
||||
</OrgNetwork>
|
||||
</OrgNetwork>
|
Loading…
Reference in New Issue