From e67d675ad2ef640403ac6eb481a1de55f93d786e Mon Sep 17 00:00:00 2001 From: tyagi Date: Tue, 12 May 2015 04:32:59 -0700 Subject: [PATCH] Add attribute type for neutron resources Add type field to the schema of the heat resources. Implements: blueprint add-type-in-attributes-schema Change-Id: Iccdacdab5790e58d10b0814aeaef85f3bf54fe51 --- .../resources/openstack/neutron/firewall.py | 42 ++++++++++++------- .../resources/openstack/neutron/floatingip.py | 21 ++++++---- .../openstack/neutron/loadbalancer.py | 31 +++++++++----- .../resources/openstack/neutron/metering.py | 9 ++-- .../engine/resources/openstack/neutron/net.py | 18 +++++--- .../openstack/neutron/network_gateway.py | 6 ++- .../resources/openstack/neutron/port.py | 39 +++++++++++------ .../openstack/neutron/provider_net.py | 9 ++-- .../resources/openstack/neutron/router.py | 18 +++++--- .../resources/openstack/neutron/subnet.py | 33 ++++++++++----- .../resources/openstack/neutron/vpnservice.py | 24 +++++++---- 11 files changed, 167 insertions(+), 83 deletions(-) diff --git a/heat/engine/resources/openstack/neutron/firewall.py b/heat/engine/resources/openstack/neutron/firewall.py index ba9a8943da..1d0360d7ef 100644 --- a/heat/engine/resources/openstack/neutron/firewall.py +++ b/heat/engine/resources/openstack/neutron/firewall.py @@ -334,47 +334,61 @@ class FirewallRule(neutron.NeutronResource): attributes_schema = { NAME_ATTR: attributes.Schema( - _('Name for the firewall rule.') + _('Name for the firewall rule.'), + type=attributes.Schema.STRING ), DESCRIPTION_ATTR: attributes.Schema( - _('Description of the firewall rule.') + _('Description of the firewall rule.'), + type=attributes.Schema.STRING ), FIREWALL_POLICY_ID: attributes.Schema( _('Unique identifier of the firewall policy to which this ' - 'firewall rule belongs.') + 'firewall rule belongs.'), + type=attributes.Schema.STRING ), SHARED_ATTR: attributes.Schema( - _('Shared status of this firewall rule.') + _('Shared status of this firewall rule.'), + type=attributes.Schema.STRING ), PROTOCOL_ATTR: attributes.Schema( - _('Protocol value for this firewall rule.') + _('Protocol value for this firewall rule.'), + type=attributes.Schema.STRING ), IP_VERSION_ATTR: attributes.Schema( - _('Ip_version for this firewall rule.') + _('Ip_version for this firewall rule.'), + type=attributes.Schema.STRING ), SOURCE_IP_ADDRESS_ATTR: attributes.Schema( - _('Source ip_address for this firewall rule.') + _('Source ip_address for this firewall rule.'), + type=attributes.Schema.STRING ), DESTINATION_IP_ADDRESS_ATTR: attributes.Schema( - _('Destination ip_address for this firewall rule.') + _('Destination ip_address for this firewall rule.'), + type=attributes.Schema.STRING ), SOURCE_PORT_ATTR: attributes.Schema( - _('Source port range for this firewall rule.') + _('Source port range for this firewall rule.'), + type=attributes.Schema.STRING ), DESTINATION_PORT_ATTR: attributes.Schema( - _('Destination port range for this firewall rule.') + _('Destination port range for this firewall rule.'), + type=attributes.Schema.STRING ), ACTION_ATTR: attributes.Schema( - _('Allow or deny action for this firewall rule.') + _('Allow or deny action for this firewall rule.'), + type=attributes.Schema.STRING ), ENABLED_ATTR: attributes.Schema( - _('Indicates whether this firewall rule is enabled or not.') + _('Indicates whether this firewall rule is enabled or not.'), + type=attributes.Schema.STRING ), POSITION: attributes.Schema( - _('Position of the rule within the firewall policy.') + _('Position of the rule within the firewall policy.'), + type=attributes.Schema.STRING ), TENANT_ID: attributes.Schema( - _('Id of the tenant owning the firewall.') + _('Id of the tenant owning the firewall.'), + type=attributes.Schema.STRING ), } diff --git a/heat/engine/resources/openstack/neutron/floatingip.py b/heat/engine/resources/openstack/neutron/floatingip.py index 5f3dc4fe32..c1b056a9be 100644 --- a/heat/engine/resources/openstack/neutron/floatingip.py +++ b/heat/engine/resources/openstack/neutron/floatingip.py @@ -92,25 +92,32 @@ class FloatingIP(neutron.NeutronResource): attributes_schema = { ROUTER_ID: attributes.Schema( _('ID of the router used as gateway, set when associated with a ' - 'port.') + 'port.'), + type=attributes.Schema.STRING ), TENANT_ID: attributes.Schema( - _('The tenant owning this floating IP.') + _('The tenant owning this floating IP.'), + type=attributes.Schema.STRING ), FLOATING_NETWORK_ID_ATTR: attributes.Schema( - _('ID of the network in which this IP is allocated.') + _('ID of the network in which this IP is allocated.'), + type=attributes.Schema.STRING ), FIXED_IP_ADDRESS_ATTR: attributes.Schema( - _('IP address of the associated port, if specified.') + _('IP address of the associated port, if specified.'), + type=attributes.Schema.STRING ), FLOATING_IP_ADDRESS_ATTR: attributes.Schema( - _('The allocated address of this IP.') + _('The allocated address of this IP.'), + type=attributes.Schema.STRING ), PORT_ID_ATTR: attributes.Schema( - _('ID of the port associated with this IP.') + _('ID of the port associated with this IP.'), + type=attributes.Schema.STRING ), SHOW: attributes.Schema( - _('All attributes.') + _('All attributes.'), + type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/neutron/loadbalancer.py b/heat/engine/resources/openstack/neutron/loadbalancer.py index 25d84a717d..c0fab16896 100644 --- a/heat/engine/resources/openstack/neutron/loadbalancer.py +++ b/heat/engine/resources/openstack/neutron/loadbalancer.py @@ -104,39 +104,50 @@ class HealthMonitor(neutron.NeutronResource): attributes_schema = { ADMIN_STATE_UP_ATTR: attributes.Schema( - _('The administrative state of this health monitor.') + _('The administrative state of this health monitor.'), + type=attributes.Schema.STRING ), DELAY_ATTR: attributes.Schema( _('The minimum time in seconds between regular connections ' - 'of the member.') + 'of the member.'), + type=attributes.Schema.STRING ), EXPECTED_CODES_ATTR: attributes.Schema( _('The list of HTTP status codes expected in response ' - 'from the member to declare it healthy.') + 'from the member to declare it healthy.'), + type=attributes.Schema.LIST ), HTTP_METHOD_ATTR: attributes.Schema( - _('The HTTP method used for requests by the monitor of type HTTP.') + _('The HTTP method used for requests by the monitor of ' + 'type HTTP.'), + type=attributes.Schema.STRING ), MAX_RETRIES_ATTR: attributes.Schema( _('Number of permissible connection failures before changing ' - 'the member status to INACTIVE.') + 'the member status to INACTIVE.'), + type=attributes.Schema.STRING ), TIMEOUT_ATTR: attributes.Schema( _('Maximum number of seconds for a monitor to wait for a ' - 'connection to be established before it times out.') + 'connection to be established before it times out.'), + type=attributes.Schema.STRING ), TYPE_ATTR: attributes.Schema( - _('One of predefined health monitor types.') + _('One of predefined health monitor types.'), + type=attributes.Schema.STRING ), URL_PATH_ATTR: attributes.Schema( _('The HTTP path used in the HTTP request used by the monitor ' - 'to test a member health.') + 'to test a member health.'), + type=attributes.Schema.STRING ), TENANT_ID: attributes.Schema( - _('Tenant owning the health monitor.') + _('Tenant owning the health monitor.'), + type=attributes.Schema.STRING ), SHOW: attributes.Schema( - _('All attributes.') + _('All attributes.'), + type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/neutron/metering.py b/heat/engine/resources/openstack/neutron/metering.py index d1c3b52a64..6b171bd843 100644 --- a/heat/engine/resources/openstack/neutron/metering.py +++ b/heat/engine/resources/openstack/neutron/metering.py @@ -58,13 +58,16 @@ class MeteringLabel(neutron.NeutronResource): attributes_schema = { NAME_ATTR: attributes.Schema( - _('Name of the metering label.') + _('Name of the metering label.'), + type=attributes.Schema.STRING ), DESCRIPTION_ATTR: attributes.Schema( - _('Description of the metering label.') + _('Description of the metering label.'), + type=attributes.Schema.STRING ), SHARED_ATTR: attributes.Schema( - _('Shared status of the metering label.') + _('Shared status of the metering label.'), + type=attributes.Schema.STRING ), } diff --git a/heat/engine/resources/openstack/neutron/net.py b/heat/engine/resources/openstack/neutron/net.py index 7f107b1d46..896fd01f89 100644 --- a/heat/engine/resources/openstack/neutron/net.py +++ b/heat/engine/resources/openstack/neutron/net.py @@ -79,22 +79,28 @@ class Net(neutron.NeutronResource): attributes_schema = { STATUS: attributes.Schema( - _("The status of the network.") + _("The status of the network."), + type=attributes.Schema.STRING ), NAME_ATTR: attributes.Schema( - _("The name of the network.") + _("The name of the network."), + type=attributes.Schema.STRING ), SUBNETS: attributes.Schema( - _("Subnets of this network.") + _("Subnets of this network."), + type=attributes.Schema.LIST ), ADMIN_STATE_UP_ATTR: attributes.Schema( - _("The administrative status of the network.") + _("The administrative status of the network."), + type=attributes.Schema.STRING ), TENANT_ID_ATTR: attributes.Schema( - _("The tenant owning this network.") + _("The tenant owning this network."), + type=attributes.Schema.STRING ), SHOW: attributes.Schema( - _("All attributes.") + _("All attributes."), + type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/neutron/network_gateway.py b/heat/engine/resources/openstack/neutron/network_gateway.py index 669fd9ad84..501e0d16e4 100644 --- a/heat/engine/resources/openstack/neutron/network_gateway.py +++ b/heat/engine/resources/openstack/neutron/network_gateway.py @@ -138,10 +138,12 @@ class NetworkGateway(neutron.NeutronResource): attributes_schema = { DEFAULT: attributes.Schema( - _("A boolean value of default flag.") + _("A boolean value of default flag."), + type=attributes.Schema.STRING ), SHOW: attributes.Schema( - _("All attributes.") + _("All attributes."), + type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/neutron/port.py b/heat/engine/resources/openstack/neutron/port.py index 486351d332..d9beb41170 100644 --- a/heat/engine/resources/openstack/neutron/port.py +++ b/heat/engine/resources/openstack/neutron/port.py @@ -209,44 +209,57 @@ class Port(neutron.NeutronResource): attributes_schema = { ADMIN_STATE_UP_ATTR: attributes.Schema( - _("The administrative state of this port.") + _("The administrative state of this port."), + type=attributes.Schema.STRING ), DEVICE_ID_ATTR: attributes.Schema( - _("Unique identifier for the device.") + _("Unique identifier for the device."), + type=attributes.Schema.STRING ), DEVICE_OWNER: attributes.Schema( - _("Name of the network owning the port.") + _("Name of the network owning the port."), + type=attributes.Schema.STRING ), FIXED_IPS_ATTR: attributes.Schema( - _("Fixed IP addresses.") + _("Fixed IP addresses."), + type=attributes.Schema.LIST ), MAC_ADDRESS_ATTR: attributes.Schema( - _("MAC address of the port.") + _("MAC address of the port."), + type=attributes.Schema.STRING ), NAME_ATTR: attributes.Schema( - _("Friendly name of the port.") + _("Friendly name of the port."), + type=attributes.Schema.STRING ), NETWORK_ID_ATTR: attributes.Schema( - _("Unique identifier for the network owning the port.") + _("Unique identifier for the network owning the port."), + type=attributes.Schema.STRING ), SECURITY_GROUPS_ATTR: attributes.Schema( - _("A list of security groups for the port.") + _("A list of security groups for the port."), + type=attributes.Schema.LIST ), STATUS: attributes.Schema( - _("The status of the port.") + _("The status of the port."), + type=attributes.Schema.STRING ), TENANT_ID: attributes.Schema( - _("Tenant owning the port.") + _("Tenant owning the port."), + type=attributes.Schema.STRING ), ALLOWED_ADDRESS_PAIRS_ATTR: attributes.Schema( _("Additional MAC/IP address pairs allowed to pass through " - "a port.") + "a port."), + type=attributes.Schema.LIST ), SHOW: attributes.Schema( - _("All attributes.") + _("All attributes."), + type=attributes.Schema.MAP ), SUBNETS_ATTR: attributes.Schema( - _("A list of all subnet attributes for the port.") + _("A list of all subnet attributes for the port."), + type=attributes.Schema.LIST ), } diff --git a/heat/engine/resources/openstack/neutron/provider_net.py b/heat/engine/resources/openstack/neutron/provider_net.py index 85b7530f39..caebe496bd 100644 --- a/heat/engine/resources/openstack/neutron/provider_net.py +++ b/heat/engine/resources/openstack/neutron/provider_net.py @@ -76,13 +76,16 @@ class ProviderNet(net.Net): attributes_schema = { STATUS: attributes.Schema( - _("The status of the network.") + _("The status of the network."), + type=attributes.Schema.STRING ), SUBNETS: attributes.Schema( - _("Subnets of this network.") + _("Subnets of this network."), + type=attributes.Schema.LIST ), SHOW: attributes.Schema( - _("All attributes.") + _("All attributes."), + type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/neutron/router.py b/heat/engine/resources/openstack/neutron/router.py index 60a9703374..ea0599ad6e 100644 --- a/heat/engine/resources/openstack/neutron/router.py +++ b/heat/engine/resources/openstack/neutron/router.py @@ -128,22 +128,28 @@ class Router(neutron.NeutronResource): attributes_schema = { STATUS: attributes.Schema( - _("The status of the router.") + _("The status of the router."), + type=attributes.Schema.STRING ), EXTERNAL_GATEWAY_INFO_ATTR: attributes.Schema( - _("Gateway network for the router.") + _("Gateway network for the router."), + type=attributes.Schema.MAP ), NAME_ATTR: attributes.Schema( - _("Friendly name of the router.") + _("Friendly name of the router."), + type=attributes.Schema.STRING ), ADMIN_STATE_UP_ATTR: attributes.Schema( - _("Administrative state of the router.") + _("Administrative state of the router."), + type=attributes.Schema.STRING ), TENANT_ID: attributes.Schema( - _("Tenant owning the router.") + _("Tenant owning the router."), + type=attributes.Schema.STRING ), SHOW: attributes.Schema( - _("All attributes.") + _("All attributes."), + type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/neutron/subnet.py b/heat/engine/resources/openstack/neutron/subnet.py index 37da107265..3a511bfdde 100644 --- a/heat/engine/resources/openstack/neutron/subnet.py +++ b/heat/engine/resources/openstack/neutron/subnet.py @@ -185,37 +185,48 @@ class Subnet(neutron.NeutronResource): attributes_schema = { NAME_ATTR: attributes.Schema( - _("Friendly name of the subnet.") + _("Friendly name of the subnet."), + type=attributes.Schema.STRING ), NETWORK_ID_ATTR: attributes.Schema( - _("Parent network of the subnet.") + _("Parent network of the subnet."), + type=attributes.Schema.STRING ), TENANT_ID_ATTR: attributes.Schema( - _("Tenant owning the subnet.") + _("Tenant owning the subnet."), + type=attributes.Schema.STRING ), ALLOCATION_POOLS_ATTR: attributes.Schema( - _("Ip allocation pools and their ranges.") + _("Ip allocation pools and their ranges."), + type=attributes.Schema.LIST ), GATEWAY_IP_ATTR: attributes.Schema( - _("Ip of the subnet's gateway.") + _("Ip of the subnet's gateway."), + type=attributes.Schema.STRING ), HOST_ROUTES_ATTR: attributes.Schema( - _("Additional routes for this subnet.") + _("Additional routes for this subnet."), + type=attributes.Schema.LIST ), IP_VERSION_ATTR: attributes.Schema( - _("Ip version for the subnet.") + _("Ip version for the subnet."), + type=attributes.Schema.STRING ), CIDR_ATTR: attributes.Schema( - _("CIDR block notation for this subnet.") + _("CIDR block notation for this subnet."), + type=attributes.Schema.STRING ), DNS_NAMESERVERS_ATTR: attributes.Schema( - _("List of dns nameservers.") + _("List of dns nameservers."), + type=attributes.Schema.LIST ), ENABLE_DHCP_ATTR: attributes.Schema( - _("'true' if DHCP is enabled for this subnet; 'false' otherwise.") + _("'true' if DHCP is enabled for this subnet; 'false' otherwise."), + type=attributes.Schema.STRING ), SHOW: attributes.Schema( - _("All attributes.") + _("All attributes."), + type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/neutron/vpnservice.py b/heat/engine/resources/openstack/neutron/vpnservice.py index 07a0e1291b..8ac357b58e 100644 --- a/heat/engine/resources/openstack/neutron/vpnservice.py +++ b/heat/engine/resources/openstack/neutron/vpnservice.py @@ -99,30 +99,38 @@ class VPNService(neutron.NeutronResource): attributes_schema = { ADMIN_STATE_UP_ATTR: attributes.Schema( - _('The administrative state of the vpn service.') + _('The administrative state of the vpn service.'), + type=attributes.Schema.STRING ), DESCRIPTION_ATTR: attributes.Schema( - _('The description of the vpn service.') + _('The description of the vpn service.'), + type=attributes.Schema.STRING ), NAME_ATTR: attributes.Schema( - _('The name of the vpn service.') + _('The name of the vpn service.'), + type=attributes.Schema.STRING ), ROUTER_ID_ATTR: attributes.Schema( _('The unique identifier of the router to which the vpn service ' - 'was inserted.') + 'was inserted.'), + type=attributes.Schema.STRING ), STATUS: attributes.Schema( - _('The status of the vpn service.') + _('The status of the vpn service.'), + type=attributes.Schema.STRING ), SUBNET_ID_ATTR: attributes.Schema( _('The unique identifier of the subnet in which the vpn service ' - 'was created.') + 'was created.'), + type=attributes.Schema.STRING ), TENANT_ID: attributes.Schema( - _('The unique identifier of the tenant owning the vpn service.') + _('The unique identifier of the tenant owning the vpn service.'), + type=attributes.Schema.STRING ), SHOW: attributes.Schema( - _('All attributes.') + _('All attributes.'), + type=attributes.Schema.MAP ), }