mirror of
https://github.com/apache/jclouds.git
synced 2025-02-10 12:06:14 +00:00
add FWaaS extension to openstack-neutron
This commit is contained in:
parent
83b104d9a0
commit
289cce042a
@ -111,6 +111,11 @@
|
|||||||
<artifactId>auto-service</artifactId>
|
<artifactId>auto-service</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.auto.value</groupId>
|
||||||
|
<artifactId>auto-value</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
@ -26,6 +26,7 @@ import org.jclouds.openstack.neutron.v2.extensions.FloatingIPApi;
|
|||||||
import org.jclouds.openstack.neutron.v2.extensions.RouterApi;
|
import org.jclouds.openstack.neutron.v2.extensions.RouterApi;
|
||||||
import org.jclouds.openstack.neutron.v2.extensions.SecurityGroupApi;
|
import org.jclouds.openstack.neutron.v2.extensions.SecurityGroupApi;
|
||||||
import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi;
|
import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi;
|
||||||
import org.jclouds.openstack.neutron.v2.features.NetworkApi;
|
import org.jclouds.openstack.neutron.v2.features.NetworkApi;
|
||||||
import org.jclouds.openstack.neutron.v2.features.PortApi;
|
import org.jclouds.openstack.neutron.v2.features.PortApi;
|
||||||
import org.jclouds.openstack.neutron.v2.features.SubnetApi;
|
import org.jclouds.openstack.neutron.v2.features.SubnetApi;
|
||||||
@ -120,4 +121,14 @@ public interface NeutronApi extends Closeable {
|
|||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<LBaaSApi> getLBaaSApi(@EndpointParam(parser = VersionAwareRegionToEndpoint.class) String region);
|
Optional<LBaaSApi> getLBaaSApi(@EndpointParam(parser = VersionAwareRegionToEndpoint.class) String region);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to FWaaS features.
|
||||||
|
*
|
||||||
|
* <h3>NOTE</h3>
|
||||||
|
* This API is an extension that may or may not be present in your OpenStack cloud. Use the Optional return type
|
||||||
|
* to determine if it is present.
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
Optional<FWaaSApi> getFWaaSApi(@EndpointParam(parser = VersionAwareRegionToEndpoint.class) String region);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of creation options for an OpenStack Neutron Firewall.
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api
|
||||||
|
* doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class CreateFirewall {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#tenantId(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#name(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#description(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#adminStateUp(Boolean)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract Boolean getAdminStateUp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#firewallPolicyId(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
|
||||||
|
@SerializedNames({ "tenant_id", "name", "description", "admin_state_up", "firewall_policy_id"})
|
||||||
|
public static CreateFirewall create(String tenantId, String name, String description, Boolean adminStateUp, String firewallPolicyId) {
|
||||||
|
return builder().tenantId(tenantId).name(name).description(description).adminStateUp(adminStateUp)
|
||||||
|
.firewallPolicyId(firewallPolicyId).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new AutoValue_CreateFirewall.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Builder toBuilder();
|
||||||
|
|
||||||
|
@AutoValue.Builder
|
||||||
|
public abstract static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param tenantId Owner of the firewall. Only admin users can specify a tenant_id other than its own.
|
||||||
|
* @return The CreateFirewall builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder tenantId(String tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name Human readable name for the firewall (255 characters limit).
|
||||||
|
* @return The CreateFirewall builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder name(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param description Human readable description for the firewall (1024 characters limit).
|
||||||
|
* @return The CreateFirewall builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder description(String description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param adminStateUp The administrative state of the firewall. If False (down), the firewall does not forward any packets.
|
||||||
|
* @return The CreateFirewall builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder adminStateUp(Boolean adminStateUp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param firewallPolicyId The firewall policy uuid that this firewall is associated with. This firewall implements the rules contained in the
|
||||||
|
* firewall policy represented by this uuid.
|
||||||
|
*
|
||||||
|
* @return The CreateFirewall builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder firewallPolicyId(String firewallPolicyId);
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean getAdminStateUp();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
|
||||||
|
public abstract CreateFirewall build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of creation options for an OpenStack Neutron Firewall Policy.
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api
|
||||||
|
* doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class CreateFirewallPolicy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#tenantId(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#name(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#description(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#shared(Boolean)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#firewallRules(java.util.List)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract List<String> getFirewallRules();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#audited(Boolean)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract Boolean getAudited();
|
||||||
|
|
||||||
|
@SerializedNames({"tenant_id", "name", "description", "shared", "firewall_rules", "audited"})
|
||||||
|
private static CreateFirewallPolicy create(String tenantId, String name, String description, Boolean shared, List<String> firewallRules, Boolean audited) {
|
||||||
|
return builder().tenantId(tenantId).name(name).description(description).shared(shared).firewallRules(firewallRules).audited(audited).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new AutoValue_CreateFirewallPolicy.Builder().shared(false).audited(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Builder toBuilder();
|
||||||
|
|
||||||
|
@AutoValue.Builder
|
||||||
|
public abstract static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param tenantId Owner of the firewall. Only admin users can specify a tenant_id other than its own.
|
||||||
|
* @return The CreateFirewallPolicy builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder tenantId(String tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name Human readable name for the firewall (255 characters limit).
|
||||||
|
* @return The CreateFirewallPolicy builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder name(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param description Human readable description for the firewall (1024 characters limit).
|
||||||
|
* @return The CreateFirewallPolicy builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder description(String description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param shared When set to True makes this firewall policy visible to tenants other than its owner and
|
||||||
|
* can be used to associate with firewalls not owned by its tenant.
|
||||||
|
* @return The CreateFirewallPolicy builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder shared(Boolean shared);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param firewallRules This is an ordered list of firewall rule uuids.
|
||||||
|
* The firewall applies the rules in the order in which they appear in this list.
|
||||||
|
* @return The CreateFirewallPolicy builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder firewallRules(List<String> firewallRules);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param audited When set to True by the policy owner indicates that the firewall policy has been audited. This attribute is meant to aid in the
|
||||||
|
* firewall policy audit work flows. Each time the firewall policy or the associated firewall rules are changed, this attribute is set
|
||||||
|
* to False and must be explicitly set to True through an update operation.
|
||||||
|
* @return The CreateFirewallPolicy builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder audited(Boolean audited);
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
@Nullable public abstract List<String> getFirewallRules();
|
||||||
|
@Nullable public abstract Boolean getAudited();
|
||||||
|
|
||||||
|
abstract CreateFirewallPolicy autoBuild();
|
||||||
|
|
||||||
|
public CreateFirewallPolicy build() {
|
||||||
|
firewallRules(getFirewallRules() != null ? ImmutableList.copyOf(getFirewallRules()) : ImmutableList.<String>of());
|
||||||
|
return autoBuild();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,231 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of creation options for an OpenStack Neutron Firewall Rule.
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api
|
||||||
|
* doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class CreateFirewallRule {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Builder#tenantId(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
/**
|
||||||
|
* @see Builder#name(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
/**
|
||||||
|
* @see Builder#description(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
/**
|
||||||
|
* @see Builder#firewallPolicyId(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
/**
|
||||||
|
* @see Builder#shared(Boolean)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
/**
|
||||||
|
* @see Builder#protocol(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getProtocol();
|
||||||
|
/**
|
||||||
|
* @see Builder#ipVersion(IpVersion)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract IpVersion getIpVersion();
|
||||||
|
/**
|
||||||
|
* @see Builder#sourceIpAddress(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getSourceIpAddress();
|
||||||
|
/**
|
||||||
|
* @see Builder#destinationIpAddress(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getDestinationIpAddress();
|
||||||
|
/**
|
||||||
|
* @see Builder#sourcePort(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getSourcePort();
|
||||||
|
/**
|
||||||
|
* @see Builder#destinationPort(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getDestinationPort();
|
||||||
|
/**
|
||||||
|
* see Builder#position(Integer)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract Integer getPosition();
|
||||||
|
/**
|
||||||
|
* @see Builder#action(String)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract String getAction();
|
||||||
|
/**
|
||||||
|
* @see Builder#enabled(Boolean)
|
||||||
|
*/
|
||||||
|
@Nullable public abstract Boolean getEnabled();
|
||||||
|
|
||||||
|
@SerializedNames({ "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address",
|
||||||
|
"destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"})
|
||||||
|
public static CreateFirewallRule create(String tenantId, String name, String description, String firewallPolicyId, Boolean shared, String protocol,
|
||||||
|
IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position,
|
||||||
|
String action, Boolean enabled) {
|
||||||
|
return builder().tenantId(tenantId).name(name).description(description).firewallPolicyId(firewallPolicyId).shared(shared)
|
||||||
|
.protocol(protocol).ipVersion(ipVersion).sourceIpAddress(sourceIpAddress).destinationIpAddress(destinationIpAddress).sourcePort(sourcePort)
|
||||||
|
.destinationPort(destinationPort).position(position).action(action).enabled(enabled).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new AutoValue_CreateFirewallRule.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Builder toBuilder();
|
||||||
|
|
||||||
|
@AutoValue.Builder
|
||||||
|
public abstract static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param tenantId Owner of the firewall. Only admin users can specify a tenant_id other than its own.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder tenantId(String tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name Human readable name for the firewall (255 characters limit).
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder name(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param description Human readable description for the firewall (1024 characters limit).
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder description(String description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param shared When set to True makes this firewall policy visible to tenants other than its owner and
|
||||||
|
* can be used to associate with firewalls not owned by its tenant.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder shared(Boolean shared);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param firewallPolicyId This is a read-only attribute that gets populated with the uuid of the firewall policy when this firewall rule is associated
|
||||||
|
* with a firewall policy. A firewall rule can be associated with only one firewall policy at a time. However, the association
|
||||||
|
* can be changed to a different firewall policy.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder firewallPolicyId(String firewallPolicyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param protocol IP protocol (icmp, tcp, udp, None).
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder protocol(String protocol);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ipVersion IP version (4, 6).
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder ipVersion(IpVersion ipVersion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param sourceIpAddress Source IP address or CIDR.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder sourceIpAddress(String sourceIpAddress);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param destinationIpAddress Destination IP address or CIDR.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder destinationIpAddress(String destinationIpAddress);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param sourcePort Source port number or a range.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder sourcePort(String sourcePort);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param destinationPort Destination port number or a range.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder destinationPort(String destinationPort);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param position This is a read-only attribute that gets assigned to this rule when the rule is associated with a firewall policy. It indicates the
|
||||||
|
* position of this rule in that firewall policy.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder position(Integer position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param action Action to be performed on the traffic matching the rule (allow, deny).
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder action(String action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param enabled When set to False, disables this rule in the firewall policy. Facilitates selectively turning off rules without having to
|
||||||
|
* disassociate the rule from the firewall policy.
|
||||||
|
* @return The CreateFirewallRule builder.
|
||||||
|
*/
|
||||||
|
public abstract Builder enabled(Boolean enabled);
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
@Nullable public abstract String getProtocol();
|
||||||
|
@Nullable public abstract IpVersion getIpVersion();
|
||||||
|
@Nullable public abstract String getSourceIpAddress();
|
||||||
|
@Nullable public abstract String getDestinationIpAddress();
|
||||||
|
@Nullable public abstract String getSourcePort();
|
||||||
|
@Nullable public abstract String getDestinationPort();
|
||||||
|
@Nullable public abstract Integer getPosition();
|
||||||
|
@Nullable public abstract String getAction();
|
||||||
|
@Nullable public abstract Boolean getEnabled();
|
||||||
|
|
||||||
|
public abstract CreateFirewallRule build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Firewall
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api
|
||||||
|
* doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class Firewall {
|
||||||
|
|
||||||
|
public abstract String getId();
|
||||||
|
public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean isAdminStateUp();
|
||||||
|
public abstract String getStatus();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
|
||||||
|
@SerializedNames({"id", "tenant_id", "name", "description", "admin_state_up", "status", "firewall_policy_id"})
|
||||||
|
public static Firewall create(String id, String tenantId, String name, String description, Boolean adminStateUp, String status, String firewallPolicyId) {
|
||||||
|
return new AutoValue_Firewall(id, tenantId, name, description, adminStateUp, status, firewallPolicyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import java.beans.ConstructorProperties;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.v2_0.domain.Link;
|
||||||
|
import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of FirewallPolicies
|
||||||
|
*/
|
||||||
|
public class FirewallPolicies extends PaginatedCollection<FirewallPolicy> {
|
||||||
|
public static final FirewallPolicies EMPTY = new FirewallPolicies(ImmutableSet.<FirewallPolicy> of(), ImmutableSet.<Link> of());
|
||||||
|
|
||||||
|
@ConstructorProperties({"firewall_policies", "firewall_policies_links"})
|
||||||
|
protected FirewallPolicies(Iterable<FirewallPolicy> firewallPolicies, Iterable<Link> firewallPoliciesLinks) {
|
||||||
|
super(firewallPolicies, firewallPoliciesLinks);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A firewall policy
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class FirewallPolicy {
|
||||||
|
|
||||||
|
public abstract String getId();
|
||||||
|
public abstract String getTenantId();
|
||||||
|
public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
public abstract boolean isShared();
|
||||||
|
@Nullable public abstract List<String> getFirewallRules();
|
||||||
|
public abstract boolean isAudited();
|
||||||
|
|
||||||
|
@SerializedNames({"id", "tenant_id", "name", "description", "shared", "firewall_rules", "audited"})
|
||||||
|
private static FirewallPolicy create(String id, String tenantId, String name, String description, boolean shared, List<String> firewallRules, boolean audited) {
|
||||||
|
return new AutoValue_FirewallPolicy(id, tenantId, name, description, shared, firewallRules, audited);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
@AutoValue
|
||||||
|
public abstract class FirewallRule {
|
||||||
|
|
||||||
|
public abstract String getId();
|
||||||
|
public abstract String getTenantId();
|
||||||
|
public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
public abstract boolean isShared();
|
||||||
|
@Nullable public abstract String getProtocol();
|
||||||
|
@Nullable public abstract IpVersion getIpVersion();
|
||||||
|
@Nullable public abstract String getSourceIpAddress();
|
||||||
|
@Nullable public abstract String getDestinationIpAddress();
|
||||||
|
@Nullable public abstract String getSourcePort();
|
||||||
|
@Nullable public abstract String getDestinationPort();
|
||||||
|
@Nullable public abstract Integer getPosition(); // for AutoValue.builder
|
||||||
|
@Nullable public abstract String getAction();
|
||||||
|
public abstract boolean isEnabled();
|
||||||
|
|
||||||
|
@SerializedNames({"id", "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address",
|
||||||
|
"destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"})
|
||||||
|
public static FirewallRule create(String id, String tenantId, String name, String description, String firewallPolicyId, boolean shared, String protocol,
|
||||||
|
IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position,
|
||||||
|
String action, boolean enabled) {
|
||||||
|
return new AutoValue_FirewallRule(id, tenantId, name, description, firewallPolicyId, shared, protocol, ipVersion, sourceIpAddress,
|
||||||
|
destinationIpAddress, sourcePort, destinationPort, position, action, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import java.beans.ConstructorProperties;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.v2_0.domain.Link;
|
||||||
|
import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of FirewallRules
|
||||||
|
*/
|
||||||
|
public class FirewallRules extends PaginatedCollection<FirewallRule> {
|
||||||
|
public static final FirewallRules EMPTY = new FirewallRules(ImmutableSet.<FirewallRule> of(), ImmutableSet.<Link> of());
|
||||||
|
|
||||||
|
@ConstructorProperties({"firewall_rules", "firewall_rules_links"})
|
||||||
|
protected FirewallRules(Iterable<FirewallRule> firewallRules, Iterable<Link> firewallRulesLinks) {
|
||||||
|
super(firewallRules, firewallRulesLinks);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import java.beans.ConstructorProperties;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.v2_0.domain.Link;
|
||||||
|
import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of Firewalls
|
||||||
|
*/
|
||||||
|
public class Firewalls extends PaginatedCollection<Firewall> {
|
||||||
|
public static final Firewalls EMPTY = new Firewalls(ImmutableSet.<Firewall> of(), ImmutableSet.<Link> of());
|
||||||
|
|
||||||
|
@ConstructorProperties({"firewalls", "firewalls_links"})
|
||||||
|
protected Firewalls(Iterable<Firewall> firewalls, Iterable<Link> firewallsLinks) {
|
||||||
|
super(firewalls, firewallsLinks);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
public enum IpVersion {
|
||||||
|
|
||||||
|
IPV4(4),
|
||||||
|
IPV6(6),
|
||||||
|
UNRECOGNIZED(Integer.MAX_VALUE);;
|
||||||
|
|
||||||
|
private final int version;
|
||||||
|
|
||||||
|
IpVersion(int version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int version() {
|
||||||
|
return this.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IpVersion fromValue(String value) {
|
||||||
|
try {
|
||||||
|
int statusCode = Integer.parseInt(value);
|
||||||
|
switch (statusCode) {
|
||||||
|
case 4:
|
||||||
|
return IpVersion.IPV4;
|
||||||
|
case 6:
|
||||||
|
return IpVersion.IPV6;
|
||||||
|
default:
|
||||||
|
return IpVersion.IPV4;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return IpVersion.UNRECOGNIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of update options for an OpenStack Neutron Firewall.
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api
|
||||||
|
* doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class UpdateFirewall {
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean getAdminStateUp();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
|
||||||
|
@SerializedNames({"tenant_id", "name", "description", "admin_state_up", "firewall_policy_id"})
|
||||||
|
public static UpdateFirewall create(String tenantId, String name, String description, Boolean adminStateUp, String firewallPolicyId) {
|
||||||
|
return builder().tenantId(tenantId).name(name).description(description).adminStateUp(adminStateUp).firewallPolicyId(firewallPolicyId).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new AutoValue_UpdateFirewall.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Builder toBuilder();
|
||||||
|
|
||||||
|
@AutoValue.Builder
|
||||||
|
public abstract static class Builder {
|
||||||
|
public abstract Builder tenantId(String tenantId);
|
||||||
|
public abstract Builder name(String name);
|
||||||
|
public abstract Builder description(String description);
|
||||||
|
public abstract Builder adminStateUp(Boolean adminStateUp);
|
||||||
|
public abstract Builder firewallPolicyId(String firewallPolicyId);
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean getAdminStateUp();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
|
||||||
|
public abstract UpdateFirewall build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of update options for an OpenStack Neutron Firewall Policy.
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api
|
||||||
|
* doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class UpdateFirewallPolicy {
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
@Nullable public abstract List<String> getFirewallRules();
|
||||||
|
@Nullable public abstract Boolean getAudited();
|
||||||
|
|
||||||
|
@SerializedNames({"tenant_id", "name", "description", "shared", "firewall_rules", "audited"})
|
||||||
|
private static UpdateFirewallPolicy create(String tenantId, String name, String description, Boolean shared, List<String> firewallRules, Boolean audited) {
|
||||||
|
return builder().tenantId(tenantId).name(name).description(description).shared(shared).firewallRules(firewallRules).audited(audited).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new AutoValue_UpdateFirewallPolicy.Builder().shared(false).audited(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Builder toBuilder();
|
||||||
|
|
||||||
|
@AutoValue.Builder
|
||||||
|
public abstract static class Builder {
|
||||||
|
public abstract Builder tenantId(String tenantId);
|
||||||
|
public abstract Builder name(String name);
|
||||||
|
public abstract Builder description(String description);
|
||||||
|
public abstract Builder shared(Boolean shared);
|
||||||
|
public abstract Builder firewallRules(List<String> firewallRules);
|
||||||
|
public abstract Builder audited(Boolean audited);
|
||||||
|
|
||||||
|
abstract UpdateFirewallPolicy autoBuild();
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
@Nullable public abstract List<String> getFirewallRules();
|
||||||
|
@Nullable public abstract Boolean getAudited();
|
||||||
|
|
||||||
|
public UpdateFirewallPolicy build() {
|
||||||
|
firewallRules(getFirewallRules() != null ? ImmutableList.copyOf(getFirewallRules()) : ImmutableList.<String>of());
|
||||||
|
return autoBuild();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.domain;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.json.SerializedNames;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of update options for an OpenStack Neutron Firewall Rule.
|
||||||
|
*
|
||||||
|
* @see <a
|
||||||
|
* href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api
|
||||||
|
* doc</a>
|
||||||
|
*/
|
||||||
|
@AutoValue
|
||||||
|
public abstract class UpdateFirewallRule {
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
@Nullable public abstract String getProtocol();
|
||||||
|
@Nullable public abstract IpVersion getIpVersion();
|
||||||
|
@Nullable public abstract String getSourceIpAddress();
|
||||||
|
@Nullable public abstract String getDestinationIpAddress();
|
||||||
|
@Nullable public abstract String getSourcePort();
|
||||||
|
@Nullable public abstract String getDestinationPort();
|
||||||
|
@Nullable public abstract Integer getPosition();
|
||||||
|
@Nullable public abstract String getAction();
|
||||||
|
@Nullable public abstract Boolean getEnabled();
|
||||||
|
|
||||||
|
@SerializedNames({ "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address",
|
||||||
|
"destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"})
|
||||||
|
public static UpdateFirewallRule create(String tenantId, String name, String description, String firewallPolicyId, Boolean shared, String protocol,
|
||||||
|
IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position,
|
||||||
|
String action, Boolean enabled) {
|
||||||
|
return builder().tenantId(tenantId).name(name).description(description).firewallPolicyId(firewallPolicyId).shared(shared)
|
||||||
|
.protocol(protocol).ipVersion(ipVersion).sourceIpAddress(sourceIpAddress).destinationIpAddress(destinationIpAddress).sourcePort(sourcePort)
|
||||||
|
.destinationPort(destinationPort).position(position).action(action).enabled(enabled).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new AutoValue_UpdateFirewallRule.Builder().shared(false).enabled(false).position(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Builder toBuilder();
|
||||||
|
|
||||||
|
@AutoValue.Builder
|
||||||
|
public abstract static class Builder {
|
||||||
|
public abstract Builder tenantId(String tenantId);
|
||||||
|
public abstract Builder name(String name);
|
||||||
|
public abstract Builder description(String description);
|
||||||
|
public abstract Builder firewallPolicyId(String firewallPolicyId);
|
||||||
|
public abstract Builder shared(Boolean shared);
|
||||||
|
public abstract Builder protocol(String protocol);
|
||||||
|
public abstract Builder ipVersion(IpVersion ipVersion);
|
||||||
|
public abstract Builder sourceIpAddress(String sourceIpAddress);
|
||||||
|
public abstract Builder destinationIpAddress(String destinationIpAddress);
|
||||||
|
public abstract Builder sourcePort(String sourcePort);
|
||||||
|
public abstract Builder destinationPort(String destinationPort);
|
||||||
|
public abstract Builder position(Integer position);
|
||||||
|
public abstract Builder action(String action);
|
||||||
|
public abstract Builder enabled(Boolean enabled);
|
||||||
|
|
||||||
|
@Nullable public abstract String getTenantId();
|
||||||
|
@Nullable public abstract String getName();
|
||||||
|
@Nullable public abstract String getDescription();
|
||||||
|
@Nullable public abstract String getFirewallPolicyId();
|
||||||
|
@Nullable public abstract Boolean getShared();
|
||||||
|
@Nullable public abstract String getProtocol();
|
||||||
|
@Nullable public abstract IpVersion getIpVersion();
|
||||||
|
@Nullable public abstract String getSourceIpAddress();
|
||||||
|
@Nullable public abstract String getDestinationIpAddress();
|
||||||
|
@Nullable public abstract String getSourcePort();
|
||||||
|
@Nullable public abstract String getDestinationPort();
|
||||||
|
@Nullable public abstract Integer getPosition();
|
||||||
|
@Nullable public abstract String getAction();
|
||||||
|
@Nullable public abstract Boolean getEnabled();
|
||||||
|
|
||||||
|
public abstract UpdateFirewallRule build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -32,6 +32,10 @@ public final class ExtensionNamespaces {
|
|||||||
* LBaaS Extension.
|
* LBaaS Extension.
|
||||||
*/
|
*/
|
||||||
public static final String LBAAS = "http://wiki.openstack.org/neutron/LBaaS/API_1.0";
|
public static final String LBAAS = "http://wiki.openstack.org/neutron/LBaaS/API_1.0";
|
||||||
|
/**
|
||||||
|
* FWaaS Extension.
|
||||||
|
*/
|
||||||
|
public static final String FWAAS = "http://wiki.openstack.org/Neutron/FWaaS/API_1.0";
|
||||||
|
|
||||||
private ExtensionNamespaces() {
|
private ExtensionNamespaces() {
|
||||||
throw new AssertionError("intentionally unimplemented");
|
throw new AssertionError("intentionally unimplemented");
|
||||||
|
@ -0,0 +1,253 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.extensions;
|
||||||
|
|
||||||
|
import static org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
|
||||||
|
import static org.jclouds.Fallbacks.FalseOnNotFoundOr404;
|
||||||
|
import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.DELETE;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.PUT;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.jclouds.collect.PagedIterable;
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
|
||||||
|
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Firewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.functions.FirewallPolicyToPagedIterable;
|
||||||
|
import org.jclouds.openstack.neutron.v2.functions.FirewallRuleToPagedIterable;
|
||||||
|
import org.jclouds.openstack.neutron.v2.functions.FirewallToPagedIterable;
|
||||||
|
import org.jclouds.openstack.neutron.v2.functions.ParseFirewallPolicies;
|
||||||
|
import org.jclouds.openstack.neutron.v2.functions.ParseFirewallRules;
|
||||||
|
import org.jclouds.openstack.neutron.v2.functions.ParseFirewalls;
|
||||||
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
|
import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
|
||||||
|
import org.jclouds.openstack.v2_0.options.PaginationOptions;
|
||||||
|
import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
|
import org.jclouds.rest.annotations.Fallback;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.ResponseParser;
|
||||||
|
import org.jclouds.rest.annotations.SelectJson;
|
||||||
|
import org.jclouds.rest.annotations.Transform;
|
||||||
|
import org.jclouds.rest.annotations.WrapWith;
|
||||||
|
|
||||||
|
import com.google.common.annotations.Beta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The FWaaS extension provides OpenStack users with the ability to deploy firewalls to protect their networks.
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* @see <a href=
|
||||||
|
* "http://specs.openstack.org/openstack/neutron-specs/specs/api/firewall_as_a_service__fwaas_.html">api doc</a>
|
||||||
|
*/
|
||||||
|
@Beta
|
||||||
|
@Path("/fw")
|
||||||
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@Extension(of = ServiceType.NETWORK, namespace = ExtensionNamespaces.FWAAS)
|
||||||
|
public interface FWaaSApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of all routers currently defined in Neutron for the current tenant. The list provides the unique
|
||||||
|
* identifier of each firewall configured for the tenant
|
||||||
|
*
|
||||||
|
* @return the list of all firewall references configured for the tenant.
|
||||||
|
*/
|
||||||
|
@Named("fw:list")
|
||||||
|
@GET
|
||||||
|
@Transform(FirewallToPagedIterable.class)
|
||||||
|
@ResponseParser(ParseFirewalls.class)
|
||||||
|
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
|
||||||
|
@Path("/firewalls")
|
||||||
|
PagedIterable<Firewall> list();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the list of all firewall references configured for the tenant.
|
||||||
|
*/
|
||||||
|
@Named("firewall:list")
|
||||||
|
@GET
|
||||||
|
@ResponseParser(ParseFirewalls.class)
|
||||||
|
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
|
||||||
|
@Path("/firewalls")
|
||||||
|
PaginatedCollection<Firewall> list(PaginationOptions options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the details for a specific firewall.
|
||||||
|
*
|
||||||
|
* @param id the id of the firewall to return
|
||||||
|
* @return firewall or empty if not found
|
||||||
|
*/
|
||||||
|
@Named("firewall:get")
|
||||||
|
@GET
|
||||||
|
@Path("/firewalls/{id}")
|
||||||
|
@SelectJson("firewall")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Nullable
|
||||||
|
Firewall get(@PathParam("id") String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new firewall
|
||||||
|
*
|
||||||
|
* @param firewall Options for creating a firewall
|
||||||
|
* @return the newly created firewall
|
||||||
|
*/
|
||||||
|
@Named("firewall:create")
|
||||||
|
@POST
|
||||||
|
@SelectJson("firewall")
|
||||||
|
@Path("/firewalls")
|
||||||
|
Firewall create(@WrapWith("firewall") CreateFirewall firewall);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a firewall
|
||||||
|
*
|
||||||
|
* @param id the id of the firewall to update
|
||||||
|
* @param updateFirewall Contains only the attributes to update
|
||||||
|
* @return The modified firewall
|
||||||
|
*/
|
||||||
|
@Named("firewall:update")
|
||||||
|
@PUT
|
||||||
|
@Path("/firewalls/{id}")
|
||||||
|
@SelectJson("firewall")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Nullable
|
||||||
|
Firewall update(@PathParam("id") String id, @WrapWith("firewall") UpdateFirewall updateFirewall);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the specified firewall
|
||||||
|
*
|
||||||
|
* @param id the id of the firewall to delete
|
||||||
|
* @return true if delete successful, false if not
|
||||||
|
*/
|
||||||
|
@Named("firewall:delete")
|
||||||
|
@DELETE
|
||||||
|
@Path("/firewalls/{id}")
|
||||||
|
@Fallback(FalseOnNotFoundOr404.class)
|
||||||
|
boolean delete(@PathParam("id") String id);
|
||||||
|
|
||||||
|
@Named("firewall:createPolicy")
|
||||||
|
@POST
|
||||||
|
@SelectJson("firewall_policy")
|
||||||
|
@Path("/firewall_policies")
|
||||||
|
FirewallPolicy createFirewallPolicy(@WrapWith("firewall_policy") CreateFirewallPolicy firewallPolicy);
|
||||||
|
|
||||||
|
@Named("firewall:listPolicies")
|
||||||
|
@GET
|
||||||
|
@Transform(FirewallPolicyToPagedIterable.class)
|
||||||
|
@ResponseParser(ParseFirewallPolicies.class)
|
||||||
|
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
|
||||||
|
@Path("/firewall_policies")
|
||||||
|
PagedIterable<FirewallPolicy> listFirewallPolicies();
|
||||||
|
|
||||||
|
@Named("firewall:listPolicies")
|
||||||
|
@GET
|
||||||
|
@ResponseParser(ParseFirewallPolicies.class)
|
||||||
|
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
|
||||||
|
@Path("/firewall_policies")
|
||||||
|
PaginatedCollection<FirewallPolicy> listFirewallPolicies(PaginationOptions options);
|
||||||
|
|
||||||
|
@Named("firewall:getPolicy")
|
||||||
|
@GET
|
||||||
|
@SelectJson("firewall_policy")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Path("/firewall_policies/{id}")
|
||||||
|
FirewallPolicy getFirewallPolicy(@PathParam("id") String id);
|
||||||
|
|
||||||
|
@Named("firewall:updatePolicy")
|
||||||
|
@PUT
|
||||||
|
@SelectJson("firewall_policy")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Path("/firewall_policies/{id}")
|
||||||
|
FirewallPolicy updateFirewallPolicy(@PathParam("id") String id, @WrapWith("firewall_policy") UpdateFirewallPolicy updateFirewallPolicy);
|
||||||
|
|
||||||
|
@Named("firewall:deletePolicy")
|
||||||
|
@DELETE
|
||||||
|
@Path("/firewall_policies/{id}")
|
||||||
|
boolean deleteFirewallPolicy(@PathParam("id") String id);
|
||||||
|
|
||||||
|
@Named("firewall:createFirewallRule")
|
||||||
|
@POST
|
||||||
|
@SelectJson("firewall_rule")
|
||||||
|
@Path("/firewall_rules")
|
||||||
|
FirewallRule createFirewallRule(@WrapWith("firewall_rule") CreateFirewallRule firewallRule);
|
||||||
|
|
||||||
|
@Named("firewall:listFirewallRules")
|
||||||
|
@GET
|
||||||
|
@Transform(FirewallRuleToPagedIterable.class)
|
||||||
|
@ResponseParser(ParseFirewallRules.class)
|
||||||
|
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
|
||||||
|
@Path("/firewall_rules")
|
||||||
|
PagedIterable<FirewallRule> listFirewallRules();
|
||||||
|
|
||||||
|
@Named("firewall:listFirewallRules")
|
||||||
|
@GET
|
||||||
|
@ResponseParser(ParseFirewallRules.class)
|
||||||
|
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
|
||||||
|
@Path("/firewall_rules")
|
||||||
|
PaginatedCollection<FirewallRule> listFirewallRules(PaginationOptions options);
|
||||||
|
|
||||||
|
@Named("firewall:getFirewallRule")
|
||||||
|
@GET
|
||||||
|
@Path("/firewall_rules/{id}")
|
||||||
|
@SelectJson("firewall_rule")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Nullable
|
||||||
|
FirewallRule getFirewallRule(@PathParam("id") String firewallRuleId);
|
||||||
|
|
||||||
|
@Named("firewall:updateFirewallRule")
|
||||||
|
@PUT
|
||||||
|
@Path("/firewall_rules/{id}")
|
||||||
|
@SelectJson("firewall_rule")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Nullable
|
||||||
|
FirewallRule updateFirewallRule(@PathParam("id") String id, @WrapWith("firewall_rule") UpdateFirewallRule updateFirewallRule);
|
||||||
|
|
||||||
|
@Named("firewall:deleteFirewallRule")
|
||||||
|
@DELETE
|
||||||
|
@Path("/firewall_rules/{id}")
|
||||||
|
@Fallback(FalseOnNotFoundOr404.class)
|
||||||
|
boolean deleteFirewallRule(@PathParam("id") String id);
|
||||||
|
|
||||||
|
@Named("firewall:insertFirewallRuleToPolicy")
|
||||||
|
@PUT
|
||||||
|
@Path("/firewall_policies/{id}/insert_rule")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Nullable
|
||||||
|
FirewallPolicy insertFirewallRuleToPolicy(@PathParam("id") String policyId, @WrapWith("firewall_rule_id") String firewallRuleId);
|
||||||
|
|
||||||
|
@Named("firewall:removeFirewallRuleFromPolicy")
|
||||||
|
@DELETE
|
||||||
|
@Path("/firewall_policies/{id}/remove_rule")
|
||||||
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
|
@Nullable
|
||||||
|
FirewallPolicy removeFirewallRuleFromPolicy(@PathParam("id") String policyId, @WrapWith("firewall_rule_id") String firewallRuleId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.jclouds.collect.IterableWithMarker;
|
||||||
|
import org.jclouds.collect.internal.Arg0ToPagedIterable;
|
||||||
|
import org.jclouds.openstack.neutron.v2.NeutronApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures FirewallRule works as PagedIterable.
|
||||||
|
*/
|
||||||
|
public class FirewallPolicyToPagedIterable extends Arg0ToPagedIterable.FromCaller<FirewallPolicy, FirewallPolicyToPagedIterable> {
|
||||||
|
|
||||||
|
private final NeutronApi api;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected FirewallPolicyToPagedIterable(NeutronApi api) {
|
||||||
|
this.api = checkNotNull(api, "api");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArg0(Optional<Object> arg0) {
|
||||||
|
String region = arg0.isPresent() ? arg0.get().toString() : null;
|
||||||
|
final FWaaSApi firewallApi = api.getFWaaSApi(region).get();
|
||||||
|
return new Function<Object, IterableWithMarker<FirewallPolicy>>() {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public IterableWithMarker<FirewallPolicy> apply(Object input) {
|
||||||
|
return IterableWithMarker.class.cast(firewallApi.listFirewallPolicies());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "listFirewallPolicies()";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.jclouds.collect.IterableWithMarker;
|
||||||
|
import org.jclouds.collect.internal.Arg0ToPagedIterable;
|
||||||
|
import org.jclouds.openstack.neutron.v2.NeutronApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures FirewallRule works as PagedIterable.
|
||||||
|
*/
|
||||||
|
public class FirewallRuleToPagedIterable extends Arg0ToPagedIterable.FromCaller<FirewallRule, FirewallRuleToPagedIterable> {
|
||||||
|
|
||||||
|
private final NeutronApi api;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected FirewallRuleToPagedIterable(NeutronApi api) {
|
||||||
|
this.api = checkNotNull(api, "api");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Function<Object, IterableWithMarker<FirewallRule>> markerToNextForArg0(Optional<Object> arg0) {
|
||||||
|
String region = arg0.isPresent() ? arg0.get().toString() : null;
|
||||||
|
final FWaaSApi firewallApi = api.getFWaaSApi(region).get();
|
||||||
|
return new Function<Object, IterableWithMarker<FirewallRule>>() {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public IterableWithMarker<FirewallRule> apply(Object input) {
|
||||||
|
return IterableWithMarker.class.cast(firewallApi.listFirewallRules());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "listFirewallRules()";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.jclouds.collect.IterableWithMarker;
|
||||||
|
import org.jclouds.collect.internal.Arg0ToPagedIterable;
|
||||||
|
import org.jclouds.openstack.neutron.v2.NeutronApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Firewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures Firewall works as PagedIterable.
|
||||||
|
*/
|
||||||
|
public class FirewallToPagedIterable extends Arg0ToPagedIterable.FromCaller<Firewall, FirewallToPagedIterable> {
|
||||||
|
|
||||||
|
private final NeutronApi api;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected FirewallToPagedIterable(NeutronApi api) {
|
||||||
|
this.api = checkNotNull(api, "api");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Function<Object, IterableWithMarker<Firewall>> markerToNextForArg0(Optional<Object> arg0) {
|
||||||
|
String region = arg0.isPresent() ? arg0.get().toString() : null;
|
||||||
|
final FWaaSApi firewallApi = api.getFWaaSApi(region).get();
|
||||||
|
return new Function<Object, IterableWithMarker<Firewall>>() {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public IterableWithMarker<Firewall> apply(Object input) {
|
||||||
|
return IterableWithMarker.class.cast(firewallApi.list());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "listFirewalls()";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.functions;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.ParseJson;
|
||||||
|
import org.jclouds.json.Json;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallPolicies;
|
||||||
|
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by jclouds to provide more specific collections and fallbacks.
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ParseFirewallPolicies extends ParseJson<FirewallPolicies> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ParseFirewallPolicies(Json json) {
|
||||||
|
super(json, TypeLiteral.get(FirewallPolicies.class));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.functions;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.ParseJson;
|
||||||
|
import org.jclouds.json.Json;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallRules;
|
||||||
|
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by jclouds to provide more specific collections and fallbacks.
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ParseFirewallRules extends ParseJson<FirewallRules> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ParseFirewallRules(Json json) {
|
||||||
|
super(json, TypeLiteral.get(FirewallRules.class));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.functions;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.ParseJson;
|
||||||
|
import org.jclouds.json.Json;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Firewalls;
|
||||||
|
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by jclouds to provide more specific collections and fallbacks.
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ParseFirewalls extends ParseJson<Firewalls> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ParseFirewalls(Json json) {
|
||||||
|
super(json, TypeLiteral.get(Firewalls.class));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,199 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.extensions;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Firewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.internal.BaseNeutronApiLiveTest;
|
||||||
|
import org.jclouds.openstack.v2_0.options.PaginationOptions;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests parsing and Guice wiring of FWaaSApi
|
||||||
|
*/
|
||||||
|
@Test(groups = "live", testName = "FWaaSApiLiveTest")
|
||||||
|
public class FWaaSApiLiveTest extends BaseNeutronApiLiveTest {
|
||||||
|
|
||||||
|
private FWaaSApi fWaaSApi;
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
|
void setUp() {
|
||||||
|
Optional<String> optionalRegion = Iterables.tryFind(api.getConfiguredRegions(), Predicates.notNull());
|
||||||
|
if (!optionalRegion.isPresent()) Assert.fail();
|
||||||
|
fWaaSApi = api.getFWaaSApi(optionalRegion.get()).get();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Smoke test for the Firewall extension for Neutron
|
||||||
|
*/
|
||||||
|
public void testCreateUpdateAndDeleteFirewallRule() {
|
||||||
|
|
||||||
|
String inboundPort = "22";
|
||||||
|
FirewallRule firewallRule = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// methods under test
|
||||||
|
firewallRule = fWaaSApi.createFirewallRule(CreateFirewallRule.builder()
|
||||||
|
.name(String.format("jclouds-test-%s-fw-rule-%s", this.getClass().getCanonicalName().toLowerCase(), inboundPort))
|
||||||
|
.description("jclouds test fw rule")
|
||||||
|
.destinationIpAddress("192.168.0.1")
|
||||||
|
.destinationPort(inboundPort)
|
||||||
|
.enabled(true)
|
||||||
|
.action("allow")
|
||||||
|
.protocol("tcp")
|
||||||
|
.build());
|
||||||
|
|
||||||
|
assertFalse(fWaaSApi.listFirewallRules().concat().toList().isEmpty());
|
||||||
|
assertNotNull(fWaaSApi.listFirewallRules(PaginationOptions.Builder.limit(1)));
|
||||||
|
|
||||||
|
// get
|
||||||
|
firewallRule = fWaaSApi.getFirewallRule(firewallRule.getId());
|
||||||
|
assertEquals(firewallRule.getName(), String.format("jclouds-test-%s-fw-rule-%s", this.getClass().getCanonicalName().toLowerCase(), inboundPort));
|
||||||
|
assertEquals(firewallRule.getDescription(), "jclouds test fw rule");
|
||||||
|
|
||||||
|
// update
|
||||||
|
FirewallRule updatedFirewallRule = fWaaSApi.updateFirewallRule(firewallRule.getId(), UpdateFirewallRule.builder().name(firewallRule.getName() + "-updated").build());
|
||||||
|
firewallRule = fWaaSApi.getFirewallRule(firewallRule.getId());
|
||||||
|
assertEquals(updatedFirewallRule, firewallRule);
|
||||||
|
} finally {
|
||||||
|
// delete
|
||||||
|
if (fWaaSApi != null) {
|
||||||
|
assertTrue(fWaaSApi.deleteFirewallRule(firewallRule.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreateUpdateAndDeleteFirewallPolicy() {
|
||||||
|
|
||||||
|
String inboundPort = "80";
|
||||||
|
FirewallRule firewallRule = fWaaSApi.createFirewallRule(CreateFirewallRule.builder()
|
||||||
|
.name(String.format("jclouds-test-%s-fw-rule-%s", this.getClass().getCanonicalName().toLowerCase(), inboundPort))
|
||||||
|
.description("jclouds test fw rule")
|
||||||
|
.destinationIpAddress("192.168.0.1")
|
||||||
|
.destinationPort(inboundPort)
|
||||||
|
.enabled(true)
|
||||||
|
.action("allow")
|
||||||
|
.protocol("tcp")
|
||||||
|
.build());
|
||||||
|
FirewallPolicy firewallPolicy = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// methods under test
|
||||||
|
firewallPolicy = fWaaSApi.createFirewallPolicy(CreateFirewallPolicy.builder()
|
||||||
|
.name(String.format("jclouds-test-%s-fw-policy", this.getClass().getCanonicalName().toLowerCase()))
|
||||||
|
.description("jclouds test fw policy")
|
||||||
|
.build());
|
||||||
|
|
||||||
|
assertFalse(fWaaSApi.listFirewallPolicies().concat().toList().isEmpty());
|
||||||
|
assertNotNull(fWaaSApi.listFirewallPolicies(PaginationOptions.Builder.limit(1)));
|
||||||
|
|
||||||
|
// get
|
||||||
|
firewallPolicy = fWaaSApi.getFirewallPolicy(firewallPolicy.getId());
|
||||||
|
assertEquals(firewallPolicy.getName(), String.format("jclouds-test-%s-fw-policy", this.getClass().getCanonicalName().toLowerCase()));
|
||||||
|
assertEquals(firewallPolicy.getDescription(), "jclouds test fw policy");
|
||||||
|
|
||||||
|
// update
|
||||||
|
FirewallPolicy updatedFirewallPolicy = fWaaSApi.updateFirewallPolicy(firewallPolicy.getId(), UpdateFirewallPolicy.builder()
|
||||||
|
.name(String.format("jclouds-test-%s-fw-policy-update", this.getClass().getCanonicalName().toLowerCase())).build());
|
||||||
|
firewallPolicy = fWaaSApi.getFirewallPolicy(firewallPolicy.getId());
|
||||||
|
assertEquals(updatedFirewallPolicy, firewallPolicy);
|
||||||
|
|
||||||
|
firewallPolicy = fWaaSApi.insertFirewallRuleToPolicy(firewallPolicy.getId(), firewallRule.getId());
|
||||||
|
assertNotNull(firewallPolicy);
|
||||||
|
assertFalse(firewallPolicy.getFirewallRules().isEmpty());
|
||||||
|
|
||||||
|
firewallPolicy = fWaaSApi.removeFirewallRuleFromPolicy(firewallPolicy.getId(), firewallRule.getId());
|
||||||
|
assertNotNull(firewallPolicy);
|
||||||
|
assertTrue(firewallPolicy.getFirewallRules().isEmpty());
|
||||||
|
} finally {
|
||||||
|
// delete
|
||||||
|
if (fWaaSApi != null) {
|
||||||
|
try {
|
||||||
|
if (firewallPolicy != null) {
|
||||||
|
assertTrue(fWaaSApi.deleteFirewallPolicy(firewallPolicy.getId()));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
assertTrue(fWaaSApi.deleteFirewallRule(firewallRule.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreateUpdateAndDeleteFirewall() {
|
||||||
|
|
||||||
|
FirewallPolicy firewallPolicy = fWaaSApi.createFirewallPolicy(CreateFirewallPolicy.builder()
|
||||||
|
.name(String.format("jclouds-test-%s-fw-policy", this.getClass().getCanonicalName().toLowerCase()))
|
||||||
|
.description("jclouds test fw policy")
|
||||||
|
.build());
|
||||||
|
|
||||||
|
Firewall firewall = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// methods under test
|
||||||
|
firewall = fWaaSApi.create(CreateFirewall.builder().name(String.format("jclouds-test-%s-fw", this.getClass().getCanonicalName().toLowerCase()))
|
||||||
|
.description("jclouds test firewall")
|
||||||
|
.firewallPolicyId(firewallPolicy.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
assertFalse(fWaaSApi.list().concat().toList().isEmpty());
|
||||||
|
assertNotNull(fWaaSApi.list(PaginationOptions.Builder.limit(1)));
|
||||||
|
|
||||||
|
// get
|
||||||
|
firewall = fWaaSApi.get(firewall.getId());
|
||||||
|
assertEquals(firewall.getName(), String.format("jclouds-test-%s-fw", this.getClass().getCanonicalName().toLowerCase()));
|
||||||
|
assertEquals(firewall.getDescription(), "jclouds test firewall");
|
||||||
|
|
||||||
|
// update
|
||||||
|
Firewall updatedFirewall = fWaaSApi.update(firewall.getId(), UpdateFirewall.builder().name(String.format("jclouds-test-%s-fw_updated", this.getClass()
|
||||||
|
.getCanonicalName().toLowerCase())).build());
|
||||||
|
firewall = fWaaSApi.get(firewall.getId());
|
||||||
|
assertEquals(updatedFirewall, firewall);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
// delete
|
||||||
|
if (fWaaSApi != null) {
|
||||||
|
try {
|
||||||
|
if (firewallPolicy != null) {
|
||||||
|
assertTrue(fWaaSApi.deleteFirewallPolicy(firewallPolicy.getId()));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (firewall != null) {
|
||||||
|
assertTrue(fWaaSApi.delete(firewall.getId()));
|
||||||
|
} }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,984 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF 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.openstack.neutron.v2.extensions;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.neutron.v2.NeutronApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.CreateFirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Firewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FloatingIP;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.FloatingIPs;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewall;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallPolicy;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallRule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.internal.BaseNeutronApiMockTest;
|
||||||
|
import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
|
||||||
|
import org.jclouds.openstack.v2_0.options.PaginationOptions;
|
||||||
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.squareup.okhttp.mockwebserver.MockResponse;
|
||||||
|
import com.squareup.okhttp.mockwebserver.MockWebServer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests Floating Api Guice wiring and parsing
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public class FWaaSApiMockTest extends BaseNeutronApiMockTest {
|
||||||
|
|
||||||
|
public void testCreateFirewall() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_create_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
CreateFirewall firewallRequest = CreateFirewall.builder()
|
||||||
|
.firewallPolicyId("c69933c1-b472-44f9-8226-30dc4ffd454c")
|
||||||
|
.adminStateUp(Boolean.TRUE)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Firewall firewall = api.create(firewallRequest);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "POST", uriApiVersion + "/fw/firewalls", "/firewall_create_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewall);
|
||||||
|
assertEquals(firewall.getName(), "");
|
||||||
|
assertEquals(firewall.getTenantId(), "45977fa2dbd7482098dd68d0d8970117");
|
||||||
|
assertEquals(firewall.getDescription(), "");
|
||||||
|
assertEquals(firewall.getId(), "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977");
|
||||||
|
assertEquals(firewall.getStatus(), "PENDING_CREATE");
|
||||||
|
assertTrue(firewall.isAdminStateUp());
|
||||||
|
assertEquals(firewall.getFirewallPolicyId(), "c69933c1-b472-44f9-8226-30dc4ffd454c");
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||||
|
public void testCreateFirewallFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
CreateFirewall firewallRequest = CreateFirewall.builder()
|
||||||
|
.firewallPolicyId("c69933c1-b472-44f9-8226-30dc4ffd454c")
|
||||||
|
.adminStateUp(Boolean.TRUE)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Firewall firewall = api.create(firewallRequest);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListSpecificPageFirewall() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/firewall_list_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
PaginatedCollection<Firewall> firewalls = api.list(PaginationOptions.Builder.limit(2).marker("abcdefg"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/fw/firewalls?limit=2&marker=abcdefg");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewalls);
|
||||||
|
assertEquals(firewalls.size(), 1);
|
||||||
|
assertEquals(Iterables.getFirst(firewalls, null).getId(), "5eb708e7-3856-449a-99ac-fec27cd745f9");
|
||||||
|
assertEquals(firewalls.get(0).getId(), "5eb708e7-3856-449a-99ac-fec27cd745f9");
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListSpecificPageFirewallFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||||
|
|
||||||
|
FloatingIPs floatingIPs = api.list(PaginationOptions.Builder.limit(2).marker("abcdefg"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/floatingips?limit=2&marker=abcdefg");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(floatingIPs);
|
||||||
|
assertTrue(floatingIPs.isEmpty());
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListPagedFirewall() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/floatingip_list_response_paged1.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/floatingip_list_response_paged2.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||||
|
|
||||||
|
// Note: Lazy! Have to actually look at the collection.
|
||||||
|
List<FloatingIP> floatingIPs = api.list().concat().toList();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 4);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/floatingips");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/floatingips?marker=71c1e68c-171a-4aa2-aca5-50ea153a3718");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(floatingIPs);
|
||||||
|
assertEquals(floatingIPs.size(), 4);
|
||||||
|
assertEquals(floatingIPs.get(0).getId(), "2f245a7b-796b-4f26-9cf9-9e82d248fda7");
|
||||||
|
assertEquals(floatingIPs.get(3).getId(), "61cea855-49cb-4846-997d-801b70c71bdd2");
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListPagedFirewallFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||||
|
|
||||||
|
// Note: Lazy! Have to actually look at the collection.
|
||||||
|
List<FloatingIP> floatingIPs = api.list().concat().toList();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/floatingips");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(floatingIPs);
|
||||||
|
assertTrue(floatingIPs.isEmpty());
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetFirewall() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_get_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
Firewall firewall = api.get("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/fw/firewalls/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewall);
|
||||||
|
assertEquals(firewall.getId(), "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977");
|
||||||
|
assertEquals(firewall.getTenantId(), "45977fa2dbd7482098dd68d0d8970117");
|
||||||
|
assertEquals(firewall.getDescription(), "");
|
||||||
|
assertEquals(firewall.getName(), "");
|
||||||
|
assertEquals(firewall.getStatus(), "ACTIVE");
|
||||||
|
assertEquals(firewall.getFirewallPolicyId(), "c69933c1-b472-44f9-8226-30dc4ffd454c");
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetFirewallFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
Firewall firewall = api.get("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/fw/firewalls/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNull(firewall);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateFirewall() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_update_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
UpdateFirewall updateFirewall = UpdateFirewall.builder()
|
||||||
|
.adminStateUp(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Firewall firewall = api.update("12345", updateFirewall);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewalls/12345", "/firewall_update_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewall);
|
||||||
|
assertFalse(firewall.isAdminStateUp());
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateFirewallFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
UpdateFirewall updateFirewall = UpdateFirewall.builder()
|
||||||
|
.adminStateUp(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Firewall firewall = api.update("12345", updateFirewall);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewalls/12345", "/firewall_update_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNull(firewall);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeleteFirewall() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
boolean result = api.delete("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "DELETE", uriApiVersion + "/fw/firewalls/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertTrue(result);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeleteFirewallFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
boolean result = api.delete("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "DELETE", uriApiVersion + "/fw/firewalls/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertFalse(result);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreateFirewallPolicy() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_policy_create_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
CreateFirewallPolicy firewallPolicyRequest = CreateFirewallPolicy.builder()
|
||||||
|
.name("jclouds-fw-policy_group-52-e8b")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallPolicy firewallPolicy = api.createFirewallPolicy(firewallPolicyRequest);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "POST", uriApiVersion + "/fw/firewall_policies", "/firewall_policy_create_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewallPolicy);
|
||||||
|
assertEquals(firewallPolicy.getName(), "jclouds-fw-policy_group-52-e8b");
|
||||||
|
assertEquals(firewallPolicy.getTenantId(), "3e00d5716204446c8d3c47a466eec25a");
|
||||||
|
assertEquals(firewallPolicy.getDescription(), "");
|
||||||
|
assertEquals(firewallPolicy.getId(), "12971159-95cf-4ca1-9baa-c82298ae0918");
|
||||||
|
assertEquals(firewallPolicy.isShared(), false);
|
||||||
|
assertEquals(firewallPolicy.getFirewallRules(), ImmutableList.of());
|
||||||
|
assertEquals(firewallPolicy.isAudited(), false);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||||
|
public void testCreateFirewallPolicyFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
CreateFirewallPolicy firewallPolicyRequest = CreateFirewallPolicy.builder()
|
||||||
|
.name("jclouds-fw-policy_group-52-e8b")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallPolicy firewallPolicy = api.createFirewallPolicy(firewallPolicyRequest);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetFirewallPolicy() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_policy_get_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
FirewallPolicy firewallPolicy = api.getFirewallPolicy("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/fw/firewall_policies/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewallPolicy);
|
||||||
|
assertEquals(firewallPolicy.getId(), "18d2f4e5-afdd-4c10-87ea-d35f38faf98c");
|
||||||
|
assertEquals(firewallPolicy.getTenantId(), "e1defcdd823741c89afd5824040deed2");
|
||||||
|
assertEquals(firewallPolicy.getDescription(), "");
|
||||||
|
assertEquals(firewallPolicy.getName(), "myfirewallrule");
|
||||||
|
assertEquals(firewallPolicy.isAudited(), false);
|
||||||
|
assertEquals(firewallPolicy.isShared(), true);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetFirewallPolicyFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
FirewallPolicy firewallPolicy = api.getFirewallPolicy("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/fw/firewall_policies/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNull(firewallPolicy);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateFirewallPolicy() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_policy_get_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
UpdateFirewallPolicy updateFirewallPolicy = UpdateFirewallPolicy.builder()
|
||||||
|
.shared(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallPolicy firewallPolicy = api.updateFirewallPolicy("12345", updateFirewallPolicy);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewall_policies/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewallPolicy);
|
||||||
|
assertEquals(firewallPolicy.getId(), "18d2f4e5-afdd-4c10-87ea-d35f38faf98c");
|
||||||
|
assertEquals(firewallPolicy.getTenantId(), "e1defcdd823741c89afd5824040deed2");
|
||||||
|
assertEquals(firewallPolicy.getDescription(), "");
|
||||||
|
assertEquals(firewallPolicy.getName(), "myfirewallrule");
|
||||||
|
assertEquals(firewallPolicy.isAudited(), false);
|
||||||
|
assertEquals(firewallPolicy.isShared(), true);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateFirewallPolicyFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
UpdateFirewallPolicy updateFirewallPolicy = UpdateFirewallPolicy.builder()
|
||||||
|
.shared(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallPolicy firewallPolicy = api.updateFirewallPolicy("12345", updateFirewallPolicy);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewall_policies/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNull(firewallPolicy);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testInsertFirewallRuleIntoFirewallPolicy() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_policy_insert_rule_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
FirewallPolicy updatedFirewallPolicy = api.insertFirewallRuleToPolicy("12345", "59585143-e819-48c9-944d-f03e0f049dba");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewall_policies/12345/insert_rule", "/firewall_policy_insert_rule_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(updatedFirewallPolicy);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testInsertFirewallRuleIntoFirewallPolicyFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
FirewallPolicy updatedFirewallPolicy = api.insertFirewallRuleToPolicy("12345", "59585143-e819-48c9-944d-f03e0f049dba");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewall_policies/12345/insert_rule", "/firewall_policy_insert_rule_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNull(updatedFirewallPolicy);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreateFirewallRule() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_rule_create_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
CreateFirewallRule firewallRuleRequest = CreateFirewallRule.builder()
|
||||||
|
.name("jclouds-fw-rule_group-52-e8b_port-22")
|
||||||
|
.tenantId("3e00d5716204446c8d3c47a466eec25a")
|
||||||
|
.protocol("tcp")
|
||||||
|
.destinationIpAddress("192.168.0.117")
|
||||||
|
.destinationPort("22")
|
||||||
|
.action("allow")
|
||||||
|
.shared(false)
|
||||||
|
.enabled(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallRule firewallRule = api.createFirewallRule(firewallRuleRequest);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "POST", uriApiVersion + "/fw/firewall_rules", "/firewall_rule_create_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewallRule);
|
||||||
|
assertEquals(firewallRule.getName(), "jclouds-fw-rule_group-52-e8b_port-22");
|
||||||
|
assertEquals(firewallRule.getTenantId(), "3e00d5716204446c8d3c47a466eec25a");
|
||||||
|
assertEquals(firewallRule.getDescription(), "");
|
||||||
|
assertEquals(firewallRule.getId(), "59585143-e819-48c9-944d-f03e0f049dba");
|
||||||
|
assertEquals(firewallRule.isShared(), false);
|
||||||
|
assertEquals(firewallRule.isEnabled(), true);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||||
|
public void testCreateFirewallRuleFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
CreateFirewallRule firewallRuleRequest = CreateFirewallRule.builder()
|
||||||
|
.name("jclouds-fw-rule_group-52-e8b_port-22")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallRule firewallRule = api.createFirewallRule(firewallRuleRequest);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetFirewallRule() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_rule_get_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
FirewallRule firewallRule = api.getFirewallRule("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/fw/firewall_rules/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewallRule);
|
||||||
|
assertEquals(firewallRule.getId(), "736b1686-3301-4a3d-9eaf-15e3c2682edc");
|
||||||
|
assertEquals(firewallRule.getTenantId(), "3e00d5716204446c8d3c47a466eec25a");
|
||||||
|
assertEquals(firewallRule.getDescription(), "jclouds test fw rule");
|
||||||
|
assertEquals(firewallRule.getName(), "jclouds-test-org.jclouds.openstack.neutron.v2.extensions.fwaasapilivetest-fw-rule-22");
|
||||||
|
assertEquals(firewallRule.getAction(), "allow");
|
||||||
|
assertEquals(firewallRule.isEnabled(), true);
|
||||||
|
assertEquals(firewallRule.getIpVersion().version(), 4);
|
||||||
|
assertEquals(firewallRule.isShared(), false);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetFirewallRuleFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
FirewallRule firewallRule = api.getFirewallRule("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "GET", uriApiVersion + "/fw/firewall_rules/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNull(firewallRule);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateFirewallRule() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_rule_update_response.json"))));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
UpdateFirewallRule updateFirewallRule = UpdateFirewallRule.builder()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallRule firewallRule = api.updateFirewallRule("12345", updateFirewallRule);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewall_rules/12345", "/firewall_rule_update_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNotNull(firewallRule);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateFirewallRuleFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
UpdateFirewallRule updateFirewallRule = UpdateFirewallRule.builder()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
FirewallRule firewallRule = api.updateFirewallRule("12345", updateFirewallRule);
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewall_rules/12345", "/firewall_rule_update_request.json");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertNull(firewallRule);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeleteFirewallRule() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(201)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
boolean result = api.deleteFirewallRule("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "DELETE", uriApiVersion + "/fw/firewall_rules/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertTrue(result);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeleteFirewallRuleFail() throws IOException, InterruptedException, URISyntaxException {
|
||||||
|
MockWebServer server = mockOpenStackServer();
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json"))));
|
||||||
|
server.enqueue(addCommonHeaders(
|
||||||
|
new MockResponse().setResponseCode(404)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||||
|
FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get();
|
||||||
|
|
||||||
|
boolean result = api.deleteFirewallRule("12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check request
|
||||||
|
*/
|
||||||
|
assertEquals(server.getRequestCount(), 3);
|
||||||
|
assertAuthentication(server);
|
||||||
|
assertExtensions(server, uriApiVersion + "");
|
||||||
|
assertRequest(server.takeRequest(), "DELETE", uriApiVersion + "/fw/firewall_rules/12345");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check response
|
||||||
|
*/
|
||||||
|
assertFalse(result);
|
||||||
|
} finally {
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -61,7 +61,7 @@ public class ExtensionApiMockTest extends BaseNeutronApiMockTest {
|
|||||||
* Check response
|
* Check response
|
||||||
*/
|
*/
|
||||||
assertNotNull(extensions);
|
assertNotNull(extensions);
|
||||||
assertEquals(extensions.size(), 17);
|
assertEquals(extensions.size(), 15);
|
||||||
} finally {
|
} finally {
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
}
|
}
|
||||||
|
@ -1,140 +1,124 @@
|
|||||||
{
|
{
|
||||||
"extensions": [
|
"extensions": [
|
||||||
{
|
{
|
||||||
"updated": "2013-01-20T00:00:00-00:00",
|
"updated": "2013-01-20T00:00:00-00:00",
|
||||||
"name": "Neutron Service Type Management",
|
"name": "Neutron Service Type Management",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0",
|
"namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0",
|
||||||
"alias": "service-type",
|
"alias": "service-type",
|
||||||
"description": "API for retrieving service providers for Neutron advanced services"
|
"description": "API for retrieving service providers for Neutron advanced services"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2012-10-05T10:00:00-00:00",
|
"updated": "2012-10-05T10:00:00-00:00",
|
||||||
"name": "security-group",
|
"name": "security-group",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/securitygroups/api/v2.0",
|
"namespace": "http://docs.openstack.org/ext/securitygroups/api/v2.0",
|
||||||
"alias": "security-group",
|
"alias": "security-group",
|
||||||
"description": "The security groups extension."
|
"description": "The security groups extension."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-02-07T10:00:00-00:00",
|
"updated": "2013-02-07T10:00:00-00:00",
|
||||||
"name": "L3 Agent Scheduler",
|
"name": "Loadbalancer Agent Scheduler",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/l3_agent_scheduler/api/v1.0",
|
"namespace": "http://docs.openstack.org/ext/lbaas_agent_scheduler/api/v1.0",
|
||||||
"alias": "l3_agent_scheduler",
|
"alias": "lbaas_agent_scheduler",
|
||||||
"description": "Schedule routers among l3 agents"
|
"description": "Schedule pools among lbaas agents"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-02-07T10:00:00-00:00",
|
"updated": "2013-02-25T10:00:00-00:00",
|
||||||
"name": "Loadbalancer Agent Scheduler",
|
"name": "Firewall service",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/lbaas_agent_scheduler/api/v1.0",
|
"namespace": "http://wiki.openstack.org/Neutron/FWaaS/API_1.0",
|
||||||
"alias": "lbaas_agent_scheduler",
|
"alias": "fwaas",
|
||||||
"description": "Schedule pools among lbaas agents"
|
"description": "Extension for Firewall service"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-03-28T10:00:00-00:00",
|
"updated": "2014-02-03T10:00:00-00:00",
|
||||||
"name": "Neutron L3 Configurable external gateway mode",
|
"name": "Port Binding",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/neutron/ext-gw-mode/api/v1.0",
|
"namespace": "http://docs.openstack.org/ext/binding/api/v1.0",
|
||||||
"alias": "ext-gw-mode",
|
"alias": "binding",
|
||||||
"description": "Extension of the router abstraction for specifying whether SNAT should occur on the external gateway"
|
"description": "Expose port bindings of a virtual port to external application"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2014-02-03T10:00:00-00:00",
|
"updated": "2012-07-29T10:00:00-00:00",
|
||||||
"name": "Port Binding",
|
"name": "Quota management support",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/binding/api/v1.0",
|
"namespace": "http://docs.openstack.org/network/ext/quotas-sets/api/v2.0",
|
||||||
"alias": "binding",
|
"alias": "quotas",
|
||||||
"description": "Expose port bindings of a virtual port to external application"
|
"description": "Expose functions for quotas management per tenant"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2012-09-07T10:00:00-00:00",
|
"updated": "2014-01-01T10:00:00-00:00",
|
||||||
"name": "Provider Network",
|
"name": "Nuage security-group",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/provider/api/v1.0",
|
"namespace": "http://nuagenetworks.net/ext/secgroup/api/v1.0",
|
||||||
"alias": "provider",
|
"alias": "nuage-security-group",
|
||||||
"description": "Expose mapping of virtual networks to physical networks"
|
"description": "Nuage security-group"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-02-03T10:00:00-00:00",
|
"updated": "2014-01-01T10:00:00-00:00",
|
||||||
"name": "agent",
|
"name": "Nuage router",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/agent/api/v2.0",
|
"namespace": "http://nuagenetworks.net/ext/routers/api/v1.0",
|
||||||
"alias": "agent",
|
"alias": "nuage-router",
|
||||||
"description": "The agent management extension."
|
"description": "Nuage Router"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2012-07-29T10:00:00-00:00",
|
"updated": "2013-01-14T10:00:00-00:00",
|
||||||
"name": "Quota management support",
|
"name": "Neutron external network",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/network/ext/quotas-sets/api/v2.0",
|
"namespace": "http://docs.openstack.org/ext/neutron/external_net/api/v1.0",
|
||||||
"alias": "quotas",
|
"alias": "external-net",
|
||||||
"description": "Expose functions for quotas management per tenant"
|
"description": "Adds external network attribute to network resource."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-02-07T10:00:00-00:00",
|
"updated": "2012-07-20T10:00:00-00:00",
|
||||||
"name": "DHCP Agent Scheduler",
|
"name": "Neutron L3 Router",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/dhcp_agent_scheduler/api/v1.0",
|
"namespace": "http://docs.openstack.org/ext/neutron/router/api/v1.0",
|
||||||
"alias": "dhcp_agent_scheduler",
|
"alias": "router",
|
||||||
"description": "Schedule networks among dhcp agents"
|
"description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-06-27T10:00:00-00:00",
|
"updated": "2014-01-01T10:00:00-00:00",
|
||||||
"name": "Multi Provider Network",
|
"name": "Nuage subnet",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/multi-provider/api/v1.0",
|
"namespace": "http://nuagenetworks.net/ext/subnets/api/v1.0",
|
||||||
"alias": "multi-provider",
|
"alias": "nuage-subnet",
|
||||||
"description": "Expose mapping of virtual networks to multiple physical networks"
|
"description": "Nuage subnet"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-01-14T10:00:00-00:00",
|
"updated": "2013-05-29T10:00:00-00:00",
|
||||||
"name": "Neutron external network",
|
"name": "VPN service",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/neutron/external_net/api/v1.0",
|
"namespace": "https://wiki.openstack.org/Neutron/VPNaaS",
|
||||||
"alias": "external-net",
|
"alias": "vpnaas",
|
||||||
"description": "Adds external network attribute to network resource."
|
"description": "Extension for VPN service"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2012-07-20T10:00:00-00:00",
|
"updated": "2014-01-01T10:00:00-00:00",
|
||||||
"name": "Neutron L3 Router",
|
"name": "NetPartition",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/neutron/router/api/v1.0",
|
"namespace": "http://nuagenetworks.net/ext/net_partition/api/v1.0",
|
||||||
"alias": "router",
|
"alias": "net-partition",
|
||||||
"description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway."
|
"description": "NetPartition"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-07-23T10:00:00-00:00",
|
"updated": "2012-10-07T10:00:00-00:00",
|
||||||
"name": "Allowed Address Pairs",
|
"name": "LoadBalancing service",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/allowedaddresspairs/api/v2.0",
|
"namespace": "http://wiki.openstack.org/neutron/LBaaS/API_1.0",
|
||||||
"alias": "allowed-address-pairs",
|
"alias": "lbaas",
|
||||||
"description": "Provides allowed address pairs"
|
"description": "Extension for LoadBalancing service"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"updated": "2013-03-17T12:00:00-00:00",
|
"updated": "2013-02-01T10:00:00-00:00",
|
||||||
"name": "Neutron Extra DHCP opts",
|
"name": "Neutron Extra Route",
|
||||||
"links": [],
|
"links": [],
|
||||||
"namespace": "http://docs.openstack.org/ext/neutron/extra_dhcp_opt/api/v1.0",
|
"namespace": "http://docs.openstack.org/ext/neutron/extraroutes/api/v1.0",
|
||||||
"alias": "extra_dhcp_opt",
|
"alias": "extraroute",
|
||||||
"description": "Extra options configuration for DHCP. For example PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name)"
|
"description": "Extra routes configuration for L3 router"
|
||||||
},
|
}
|
||||||
{
|
]
|
||||||
"updated": "2012-10-07T10:00:00-00:00",
|
|
||||||
"name": "LoadBalancing service",
|
|
||||||
"links": [],
|
|
||||||
"namespace": "http://wiki.openstack.org/neutron/LBaaS/API_1.0",
|
|
||||||
"alias": "lbaas",
|
|
||||||
"description": "Extension for LoadBalancing service"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"updated": "2013-02-01T10:00:00-00:00",
|
|
||||||
"name": "Neutron Extra Route",
|
|
||||||
"links": [],
|
|
||||||
"namespace": "http://docs.openstack.org/ext/neutron/extraroutes/api/v1.0",
|
|
||||||
"alias": "extraroute",
|
|
||||||
"description": "Extra routes configuration for L3 router"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"firewall": {
|
||||||
|
"admin_state_up": true,
|
||||||
|
"firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"firewall": {
|
||||||
|
"admin_state_up": true,
|
||||||
|
"description": "",
|
||||||
|
"firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
|
||||||
|
"id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977",
|
||||||
|
"name": "",
|
||||||
|
"status": "PENDING_CREATE",
|
||||||
|
"tenant_id": "45977fa2dbd7482098dd68d0d8970117"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"firewall": {
|
||||||
|
"admin_state_up": true,
|
||||||
|
"description": "",
|
||||||
|
"firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
|
||||||
|
"id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977",
|
||||||
|
"name": "",
|
||||||
|
"status": "ACTIVE",
|
||||||
|
"tenant_id": "45977fa2dbd7482098dd68d0d8970117"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"firewalls": [
|
||||||
|
{
|
||||||
|
"status": "ACTIVE",
|
||||||
|
"name": "fw",
|
||||||
|
"admin_state_up": true,
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"firewall_policy_id": "5083ef0d-7ad2-4305-acd8-bd036c332e1e",
|
||||||
|
"id": "5eb708e7-3856-449a-99ac-fec27cd745f9",
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"firewall_policy": {
|
||||||
|
"name": "jclouds-fw-policy_group-52-e8b",
|
||||||
|
"shared": false,
|
||||||
|
"firewall_rules": [],
|
||||||
|
"audited": false
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"firewall_policy": {
|
||||||
|
"name": "jclouds-fw-policy_group-52-e8b",
|
||||||
|
"firewall_rules": [],
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"audited": false,
|
||||||
|
"shared": false,
|
||||||
|
"id": "12971159-95cf-4ca1-9baa-c82298ae0918",
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"firewall_policy": {
|
||||||
|
"name": "myfirewallrule",
|
||||||
|
"firewall_rules": [
|
||||||
|
"3e5a4e53-4390-4b22-baea-75529dbeafb8",
|
||||||
|
"4e58f636-1ef1-4e8e-b3ad-5f7f9d1f9f23"
|
||||||
|
],
|
||||||
|
"tenant_id": "e1defcdd823741c89afd5824040deed2",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "18d2f4e5-afdd-4c10-87ea-d35f38faf98c",
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{"firewall_rule_id": "59585143-e819-48c9-944d-f03e0f049dba"}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "jclouds-fw-policy_group-52-e8b",
|
||||||
|
"firewall_rules": ["59585143-e819-48c9-944d-f03e0f049dba"],
|
||||||
|
"shared": false,
|
||||||
|
"audited": false,
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"id": "12971159-95cf-4ca1-9baa-c82298ae0918",
|
||||||
|
"firewall_list": [],
|
||||||
|
"description": ""
|
||||||
|
}
|
@ -0,0 +1,255 @@
|
|||||||
|
{
|
||||||
|
"firewall_policies": [
|
||||||
|
{
|
||||||
|
"name": "myfirewallrule",
|
||||||
|
"firewall_rules": [
|
||||||
|
"3e5a4e53-4390-4b22-baea-75529dbeafb8",
|
||||||
|
"4e58f636-1ef1-4e8e-b3ad-5f7f9d1f9f23"
|
||||||
|
],
|
||||||
|
"tenant_id": "e1defcdd823741c89afd5824040deed2",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "18d2f4e5-afdd-4c10-87ea-d35f38faf98c",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Policy SBT",
|
||||||
|
"firewall_rules": [],
|
||||||
|
"tenant_id": "ba6ba03f266e4ccfb07d2372bc8d68a2",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "31d6368b-3d8b-49a1-af5d-901283223801",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "FW-POLICY-DEMO",
|
||||||
|
"firewall_rules": [
|
||||||
|
"e434b562-c33f-4d64-84da-adfaaa94630e",
|
||||||
|
"03a3d9d7-eb92-49c4-83c1-a479ec37d87b",
|
||||||
|
"1086d52d-2323-434d-a1e8-ade5791fb5ac",
|
||||||
|
"7240cdf3-a8da-4006-90e2-9191d998fee0",
|
||||||
|
"eec4cdbe-859f-45c5-9acb-1935056af1e4",
|
||||||
|
"a18ee08e-9d5d-4c9e-9372-c4b8f71c6c75",
|
||||||
|
"7aefe7f9-01f6-4387-900e-177684e3c59d",
|
||||||
|
"b6017900-7811-4428-9940-a02033042c88",
|
||||||
|
"94129848-4eb8-4c8e-9164-cd8ee60faa49",
|
||||||
|
"e0649a2b-a327-45ed-a3a0-f068cb3fcf37",
|
||||||
|
"53f5bf0a-05e3-4a30-800b-611151a9685d",
|
||||||
|
"e07558b1-5e18-4d2d-a79b-0a95f36d1715",
|
||||||
|
"43931a28-513d-4cbb-80fa-464bf49df65f",
|
||||||
|
"79572a32-fda4-4f2c-bdad-bb11a08af9ed"
|
||||||
|
],
|
||||||
|
"tenant_id": "cfb5b69938dc49f19f192eabf62a32e6",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "4c0743e4-0361-4ed0-a6ce-2a8959d978a9",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fw-policy",
|
||||||
|
"firewall_rules": [
|
||||||
|
"3c51d308-1c5c-4776-b4ac-6d3c9ebd5685",
|
||||||
|
"e614f597-4eb2-457a-a102-5b9ad2beba42",
|
||||||
|
"e908239c-2b40-4afa-8ec3-9c4b437367da",
|
||||||
|
"1ae9b906-9250-4f8c-a262-b0fe6e7b1680",
|
||||||
|
"daa2ee3c-760c-4c67-81a8-e61a310366f1",
|
||||||
|
"1bd356b4-d0b0-4a86-a5a3-3245ac838960",
|
||||||
|
"e72605a4-f866-4cfe-9962-6577c4a87a4d"
|
||||||
|
],
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"audited": false,
|
||||||
|
"shared": false,
|
||||||
|
"id": "5083ef0d-7ad2-4305-acd8-bd036c332e1e",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PolicyOfTheVoid",
|
||||||
|
"firewall_rules": [],
|
||||||
|
"tenant_id": "85c79b517ef6431881c9477d2227be5f",
|
||||||
|
"audited": true,
|
||||||
|
"shared": true,
|
||||||
|
"id": "60779a72-21bd-4b97-a587-cd5fb8b8e7c0",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Policy",
|
||||||
|
"firewall_rules": [
|
||||||
|
"2b6646ea-a0d8-4982-b3e2-e14ad2743428",
|
||||||
|
"21a42289-b05c-4271-9f06-1172b88c8465",
|
||||||
|
"7b998345-1660-428f-969d-bfcdb4c0dbaf",
|
||||||
|
"8996fcfd-b88d-4b68-bff7-5fb07fc0088a",
|
||||||
|
"55b96a08-f868-45fd-9386-1fd831b7b63b",
|
||||||
|
"df5aaeb6-50d7-4344-9f00-f973d5e28185",
|
||||||
|
"bc23bcb1-1a81-4658-b72d-485da3af8a8a"
|
||||||
|
],
|
||||||
|
"tenant_id": "ccef3550ec724607a8024977b3b4e410",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "63337440-d0ad-4a3c-9e26-777a6e360119",
|
||||||
|
"description": "Ping + SSH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "allow_all",
|
||||||
|
"firewall_rules": ["d52ea23a-9911-44ef-815b-f3b4b6b0df64"],
|
||||||
|
"tenant_id": "53b1ed26b8874556bc7141f9482fd789",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "6e3d5d6d-1356-43eb-91ef-d6f70888632d",
|
||||||
|
"description": "Allow All"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Politique Production",
|
||||||
|
"firewall_rules": [
|
||||||
|
"a6f58b76-5c90-4530-908c-cc7dbd945a4b",
|
||||||
|
"3521380b-624c-42a1-8415-992b52a9dfec",
|
||||||
|
"fbcf3060-bd0c-4cd9-b4b1-cf3c76b7fe7d",
|
||||||
|
"45aecaba-a659-490a-8f12-92adfda79c15",
|
||||||
|
"5cfc4e09-a765-4f4e-93d5-8a9650f051f8",
|
||||||
|
"304ff502-eb6f-46b5-8110-c75a483c23e0",
|
||||||
|
"1662f0bb-a9a6-415a-b1a7-19ba113d7a52",
|
||||||
|
"8bbd0490-452c-4bee-a70f-213558e0bc65",
|
||||||
|
"e39fcf85-bea2-49fa-8a8e-c69c5f2e29ae",
|
||||||
|
"1bbdd6ba-9ae8-4cd3-8815-ef992c56cb63",
|
||||||
|
"100e638c-77cf-4f1e-8194-5a26171f645a",
|
||||||
|
"91b8316c-96ae-41da-9c14-42e1f778c0a8"
|
||||||
|
],
|
||||||
|
"tenant_id": "13a12b25d3cf4275905e2a6b9878a619",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "89d7ef67-4cb8-485f-83ac-14085e616137",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "any-shared",
|
||||||
|
"firewall_rules": ["b35ab1c6-309d-4690-b16c-0343a535651c"],
|
||||||
|
"tenant_id": "3fdcdc95fc88431597700dbb20be37c6",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "a0a3a1b1-d985-4507-b785-311f8e981fa6",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "production",
|
||||||
|
"firewall_rules": ["5dbe3498-b230-4b34-9915-7bcc22bed99c"],
|
||||||
|
"tenant_id": "94eb5f2fd9ed471992e2c5c2313b0703",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "a23d0af2-3124-49cf-ae04-02c175eda549",
|
||||||
|
"description": "production"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PolProdStdDmz1",
|
||||||
|
"firewall_rules": [
|
||||||
|
"3178c9f6-f017-462b-b93f-715e11247c30",
|
||||||
|
"2b775a98-9813-48e0-8f32-a04dfc176872",
|
||||||
|
"a5a7e990-fbe4-429b-a55c-35df087b6f80",
|
||||||
|
"6ca67373-b89e-492d-94c6-1c40765800ce",
|
||||||
|
"bf93dda9-6f42-42cf-852f-689b6facf5b4",
|
||||||
|
"e3bd91ee-1337-4d73-9484-836a0fb5869b"
|
||||||
|
],
|
||||||
|
"tenant_id": "3345a933109049779647ff02ca498f3a",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "afc19c5c-d136-4dbf-b614-c0b784a4f68d",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ALL",
|
||||||
|
"firewall_rules": [
|
||||||
|
"43bfdc83-5f76-407d-b851-5803d4e23f0b",
|
||||||
|
"316965f2-4242-4c56-8e34-22f4ff1992a3",
|
||||||
|
"1fb6cbde-4446-4bef-9eac-cc6b76afc565",
|
||||||
|
"a3da3767-608d-493d-b15a-1793d66891c8",
|
||||||
|
"6f58413b-3667-41f6-93b4-eef813632aee",
|
||||||
|
"a28bdf75-894f-4af5-9063-e2fcee4cb01d",
|
||||||
|
"0ed005c7-2d89-43a1-8aaf-714d44858173",
|
||||||
|
"710e513c-df2b-4c78-8572-bd9701f5b108",
|
||||||
|
"016922c5-7810-41cb-ae2c-04bbd87b3b24",
|
||||||
|
"22d6ade0-0f0d-473a-9cec-4b5ba22db8e4",
|
||||||
|
"7ed0e62c-848d-4e4e-baa7-eea7e9c3c3ec",
|
||||||
|
"05a34244-0922-4a6d-b551-c95c500f2194",
|
||||||
|
"9d40ac55-0802-4590-aa89-8199dab7038f",
|
||||||
|
"3d1f3c70-44e1-4c6e-9253-53421976d707",
|
||||||
|
"4d22985f-ad50-459d-af00-eea902900e41",
|
||||||
|
"dd16596d-065d-4a3a-bb75-054ab7acf54f",
|
||||||
|
"33228008-6dba-4270-9c55-3d8752472795",
|
||||||
|
"46ea5a1c-8b4b-4eaf-b9c2-767efa8bc2ae",
|
||||||
|
"3b3c3136-d914-46ae-ace3-726f638ed1d5",
|
||||||
|
"2c3f8fce-3d05-405a-8249-1d3843b8a62d",
|
||||||
|
"23106a5d-556e-4e78-af13-1d0c9280b2e2",
|
||||||
|
"40e342d6-86fc-4205-b306-e9dcd816b958",
|
||||||
|
"bf290614-8ab0-487f-811f-4474a51a40d3",
|
||||||
|
"08b91c69-310d-4d55-bea1-ffe0d95e150b",
|
||||||
|
"8e9509ff-93cb-442d-92c6-1cfb79b9243c",
|
||||||
|
"019bd1b9-2f2b-4cfa-b645-6eb779d4622e",
|
||||||
|
"4f7fd6e2-7ac5-4a46-8e3d-c4dcdde8a3f0",
|
||||||
|
"4fd8fc8b-c449-457d-8526-6ba23f6f299d",
|
||||||
|
"e2a96758-70ba-499c-bd97-6d8ee55610ed",
|
||||||
|
"ade798f5-862a-442b-8168-f39a06030535"
|
||||||
|
],
|
||||||
|
"tenant_id": "b6e174b62a964db7bf897a38b92fc217",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "e0f918c2-7a10-45d1-a5f9-9b2a2026bf3e",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Pre-Prod",
|
||||||
|
"firewall_rules": [
|
||||||
|
"fd124f42-f064-4259-b840-1ca05203c6b7",
|
||||||
|
"f03bd950-6c56-4f5e-a307-45967078f507"
|
||||||
|
],
|
||||||
|
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "e2a5fb51-698c-4898-87e8-f1eee6b50919",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ports VM ouverts",
|
||||||
|
"firewall_rules": ["c5535724-8ed8-4e50-933a-17e37b06994d"],
|
||||||
|
"tenant_id": "66165eac36f846099ab3f667f0c05229",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "e5b8e392-1e70-4948-a6a4-b3726b528059",
|
||||||
|
"description": "ouverture de tous les ports du projet stagiaires"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "www",
|
||||||
|
"firewall_rules": [
|
||||||
|
"75452b36-268e-4e75-aaf4-f0e7ed50bc97",
|
||||||
|
"c9e77ca0-1bc8-497d-904d-948107873dc6",
|
||||||
|
"67004fb6-9111-441f-a3c1-b94b08bbd496",
|
||||||
|
"80965cc0-2d60-48e8-8fe9-78be016f10b6",
|
||||||
|
"41c72886-f39d-450e-b4b5-818ebddf17d5",
|
||||||
|
"c854fab5-bdaf-4a86-9359-78de93e5df01",
|
||||||
|
"350288f9-4aea-4e13-b434-91141e5e5960",
|
||||||
|
"03d2a6ad-633f-431a-8463-4370d06a22c8"
|
||||||
|
],
|
||||||
|
"tenant_id": "9145d91459d248b1b02fdaca97c6a75d",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "f2b08c1e-aa81-4668-8ae1-1401bcb0576c",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fw-policy",
|
||||||
|
"firewall_rules": [
|
||||||
|
"32ea5280-b601-4531-903f-ddef6dd1b733",
|
||||||
|
"f6f39ac3-0bda-47ff-b8b9-f089a5440e19",
|
||||||
|
"dad47cfb-893f-4d7c-8e40-c7a86bcda175",
|
||||||
|
"1d089edc-ae35-4c60-b6af-79b69e2f3247",
|
||||||
|
"eac689d5-ce70-4d4a-bf43-5d1416ebb770",
|
||||||
|
"3c1318de-e095-4870-a2ec-3091fee81683",
|
||||||
|
"beb6249b-5e98-4c25-a356-d45f5b0cae29",
|
||||||
|
"b4b2362e-0d16-42ef-b8e4-9de56ca00c84",
|
||||||
|
"72c159d0-4777-4468-9136-543ba42d18f0"
|
||||||
|
],
|
||||||
|
"tenant_id": "94eb5f2fd9ed471992e2c5c2313b0703",
|
||||||
|
"audited": false,
|
||||||
|
"shared": true,
|
||||||
|
"id": "f66e862e-9982-465e-a5af-79d61ca9c6eb",
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"firewall_rule": {
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"name": "jclouds-fw-rule_group-52-e8b_port-22",
|
||||||
|
"shared": false,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"destination_ip_address": "192.168.0.117",
|
||||||
|
"destination_port": "22",
|
||||||
|
"action": "allow",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"firewall_rule": {
|
||||||
|
"protocol": "tcp",
|
||||||
|
"description": "",
|
||||||
|
"source_port": null,
|
||||||
|
"source_ip_address": null,
|
||||||
|
"destination_ip_address": "192.168.0.117",
|
||||||
|
"firewall_policy_id": null,
|
||||||
|
"position": null,
|
||||||
|
"destination_port": "22",
|
||||||
|
"id": "59585143-e819-48c9-944d-f03e0f049dba",
|
||||||
|
"name": "jclouds-fw-rule_group-52-e8b_port-22",
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"enabled": true,
|
||||||
|
"action": "allow",
|
||||||
|
"ip_version": 4,
|
||||||
|
"shared": false
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"firewall_rule": {
|
||||||
|
"protocol": "tcp",
|
||||||
|
"description": "jclouds test fw rule",
|
||||||
|
"source_port": null,
|
||||||
|
"source_ip_address": null,
|
||||||
|
"destination_ip_address": "192.168.0.1",
|
||||||
|
"firewall_policy_id": null,
|
||||||
|
"position": null,
|
||||||
|
"destination_port": "22",
|
||||||
|
"id": "736b1686-3301-4a3d-9eaf-15e3c2682edc",
|
||||||
|
"name": "jclouds-test-org.jclouds.openstack.neutron.v2.extensions.fwaasapilivetest-fw-rule-22",
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"enabled": true,
|
||||||
|
"action": "allow",
|
||||||
|
"ip_version": 4,
|
||||||
|
"shared": false
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"firewall_rule": {
|
||||||
|
"shared": false,
|
||||||
|
"enabled": false
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"firewall_rule": {
|
||||||
|
"protocol": "tcp",
|
||||||
|
"description": "jclouds test fw rule",
|
||||||
|
"source_port": null,
|
||||||
|
"source_ip_address": null,
|
||||||
|
"destination_ip_address": "192.168.0.1",
|
||||||
|
"firewall_policy_id": null,
|
||||||
|
"position": null,
|
||||||
|
"destination_port": "22",
|
||||||
|
"id": "736b1686-3301-4a3d-9eaf-15e3c2682edc",
|
||||||
|
"name": "jclouds-test-org.jclouds.openstack.neutron.v2.extensions.fwaasapilivetest-fw-rule-22-updated",
|
||||||
|
"tenant_id": "3e00d5716204446c8d3c47a466eec25a",
|
||||||
|
"enabled": false,
|
||||||
|
"action": "allow",
|
||||||
|
"ip_version": 4,
|
||||||
|
"shared": false
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"firewall": {
|
||||||
|
"admin_state_up": false
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"firewall": {
|
||||||
|
"admin_state_up": false,
|
||||||
|
"description": "",
|
||||||
|
"firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c",
|
||||||
|
"id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977",
|
||||||
|
"name": "",
|
||||||
|
"status": "PENDING_UPDATE",
|
||||||
|
"tenant_id": "45977fa2dbd7482098dd68d0d8970117"
|
||||||
|
}
|
||||||
|
}
|
@ -17,40 +17,19 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<configuration scan="false">
|
<configuration>
|
||||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<file>target/test-data/jclouds.log</file>
|
|
||||||
|
|
||||||
<encoder>
|
<encoder>
|
||||||
<Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
|
<pattern>- %msg%n</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
<root level="info">
|
||||||
<appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
|
<appender-ref ref="STDOUT"/>
|
||||||
<file>target/test-data/jclouds-wire.log</file>
|
|
||||||
|
|
||||||
<encoder>
|
|
||||||
<Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<level value="warn" />
|
|
||||||
</root>
|
</root>
|
||||||
|
<logger name="jclouds.compute" level="debug"/>
|
||||||
<logger name="org.jclouds">
|
<logger name="net.schmizz" level="warn"/>
|
||||||
<level value="DEBUG" />
|
<logger name="jclouds.wire" level="debug"/>
|
||||||
<appender-ref ref="FILE" />
|
<logger name="jclouds.headers" level="debug"/>
|
||||||
</logger>
|
<logger name="jclouds.ssh" level="debug"/>
|
||||||
|
|
||||||
<logger name="jclouds.wire">
|
|
||||||
<level value="DEBUG" />
|
|
||||||
<appender-ref ref="WIREFILE" />
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<logger name="jclouds.headers">
|
|
||||||
<level value="DEBUG" />
|
|
||||||
<appender-ref ref="WIREFILE" />
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user