예제 #1
0
파일: amphora.py 프로젝트: zwyw610/octavia
class AmphoraResponse(BaseAmphoraType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    loadbalancer_id = wtypes.wsattr(wtypes.UuidType())
    compute_id = wtypes.wsattr(wtypes.UuidType())
    lb_network_ip = wtypes.wsattr(types.IPAddressType())
    vrrp_ip = wtypes.wsattr(types.IPAddressType())
    ha_ip = wtypes.wsattr(types.IPAddressType())
    vrrp_port_id = wtypes.wsattr(wtypes.UuidType())
    ha_port_id = wtypes.wsattr(wtypes.UuidType())
    cert_expiration = wtypes.wsattr(wtypes.datetime.datetime)
    cert_busy = wtypes.wsattr(bool)
    role = wtypes.wsattr(wtypes.StringType())
    status = wtypes.wsattr(wtypes.StringType())
    vrrp_interface = wtypes.wsattr(wtypes.StringType())
    vrrp_id = wtypes.wsattr(wtypes.IntegerType())
    vrrp_priority = wtypes.wsattr(wtypes.IntegerType())
    cached_zone = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    image_id = wtypes.wsattr(wtypes.UuidType())
    compute_flavor = wtypes.wsattr(wtypes.StringType())

    @classmethod
    def from_data_model(cls, data_model, children=False):
        amphorae = super(AmphoraResponse,
                         cls).from_data_model(data_model, children=children)

        return amphorae
예제 #2
0
class MemberSingleCreate(BaseMemberType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    address = wtypes.wsattr(types.IPAddressType(), mandatory=True)
    protocol_port = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER),
        mandatory=True)
    weight = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_WEIGHT, maximum=constants.MAX_WEIGHT), default=1)
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    monitor_port = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER))
    monitor_address = wtypes.wsattr(types.IPAddressType())
예제 #3
0
class MemberPOST(base.BaseType):
    """Defines mandatory and optional attributes of a POST request."""
    id = wtypes.wsattr(wtypes.UuidType())
    enabled = wtypes.wsattr(bool, default=True)
    ip_address = wtypes.wsattr(base.IPAddressType(), mandatory=True)
    protocol_port = wtypes.wsattr(wtypes.IntegerType(), mandatory=True)
    weight = wtypes.wsattr(wtypes.IntegerType(), default=1)
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    monitor_port = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER),
                                 default=None)
    monitor_address = wtypes.wsattr(base.IPAddressType(), default=None)
예제 #4
0
class MemberResponse(base.BaseType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    enabled = wtypes.wsattr(bool)
    ip_address = wtypes.wsattr(base.IPAddressType())
    protocol_port = wtypes.wsattr(wtypes.IntegerType())
    weight = wtypes.wsattr(wtypes.IntegerType())
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    project_id = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    monitor_address = wtypes.wsattr(base.IPAddressType())
    monitor_port = wtypes.wsattr(wtypes.IntegerType())
예제 #5
0
class MemberResponse(BaseMemberType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    address = wtypes.wsattr(types.IPAddressType())
    protocol_port = wtypes.wsattr(wtypes.IntegerType())
    weight = wtypes.wsattr(wtypes.IntegerType())
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType())
    # TODO(johnsom) Remove after deprecation (R series)
    tenant_id = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)

    @classmethod
    def from_data_model(cls, data_model, children=False):
        member = super(MemberResponse, cls).from_data_model(
            data_model, children=children)
        member.tenant_id = data_model.project_id
        if not member.name:
            member.name = ""

        return member
예제 #6
0
class SessionPersistencePUT(types.BaseType):
    """Defines attributes that are acceptable of a PUT request."""
    type = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_SP_TYPES))
    cookie_name = wtypes.wsattr(wtypes.StringType(max_length=255),
                                default=None)
    persistence_timeout = wtypes.wsattr(wtypes.IntegerType(), default=None)
    persistence_granularity = wtypes.wsattr(types.IPAddressType(),
                                            default=None)
예제 #7
0
파일: member.py 프로젝트: syoder89/octavia
class MemberPOST(BaseMemberType):
    """Defines mandatory and optional attributes of a POST request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    address = wtypes.wsattr(types.IPAddressType(), mandatory=True)
    protocol_port = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER),
        mandatory=True)
    weight = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_WEIGHT, maximum=constants.MAX_WEIGHT), default=1)
    backup = wtypes.wsattr(bool, default=False)
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    # TODO(johnsom) Remove after deprecation (R series)
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    monitor_port = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER),
        default=None)
    monitor_address = wtypes.wsattr(types.IPAddressType(), default=None)
예제 #8
0
class MemberPUT(BaseMemberType):
    """Defines attributes that are acceptable of a PUT request."""
    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool)
    weight = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_WEIGHT, maximum=constants.MAX_WEIGHT))
    monitor_port = wtypes.wsattr(wtypes.IntegerType(
        minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER))
    monitor_address = wtypes.wsattr(types.IPAddressType())
예제 #9
0
class SessionPersistencePOST(types.BaseType):
    """Defines mandatory and optional attributes of a POST request."""
    type = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_SP_TYPES),
                         mandatory=True)
    cookie_name = wtypes.wsattr(wtypes.StringType(max_length=255),
                                default=None)
    persistence_timeout = wtypes.wsattr(wtypes.IntegerType(), default=None)
    persistence_granularity = wtypes.wsattr(types.IPAddressType(),
                                            default=None)
예제 #10
0
class MemberPUT(base.BaseType):
    """Defines attributes that are acceptable of a PUT request."""
    protocol_port = wtypes.wsattr(wtypes.IntegerType())
    enabled = wtypes.wsattr(bool)
    weight = wtypes.wsattr(wtypes.IntegerType())
    monitor_address = wtypes.wsattr(base.IPAddressType())
    monitor_port = wtypes.wsattr(
        wtypes.IntegerType(minimum=constants.MIN_PORT_NUMBER,
                           maximum=constants.MAX_PORT_NUMBER))
예제 #11
0
class LoadBalancerResponse(BaseLoadBalancerType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    description = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    project_id = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    vip_address = wtypes.wsattr(types.IPAddressType())
    vip_port_id = wtypes.wsattr(wtypes.UuidType())
    vip_subnet_id = wtypes.wsattr(wtypes.UuidType())
    vip_network_id = wtypes.wsattr(wtypes.UuidType())
    listeners = wtypes.wsattr([types.IdOnlyType])
    pools = wtypes.wsattr([types.IdOnlyType])
    provider = wtypes.wsattr(wtypes.StringType())
    flavor_id = wtypes.wsattr(wtypes.UuidType())
    vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
    distributor = wtypes.wsattr(wtypes.UuidType())
    amphora_number = wtypes.wsattr(wtypes.IntegerType())
    expected_amphora_number = wtypes.wsattr(wtypes.IntegerType())

    @classmethod
    def from_data_model(cls, data_model, children=False):
        result = super(LoadBalancerResponse,
                       cls).from_data_model(data_model, children=children)
        if data_model.vip:
            result.vip_subnet_id = data_model.vip.subnet_id
            result.vip_port_id = data_model.vip.port_id
            result.vip_address = data_model.vip.ip_address
            result.vip_network_id = data_model.vip.network_id
            result.vip_qos_policy_id = data_model.vip.qos_policy_id
        if cls._full_response():
            listener_model = listener.ListenerFullResponse
            pool_model = pool.PoolFullResponse
        else:
            listener_model = types.IdOnlyType
            pool_model = types.IdOnlyType
        result.listeners = [
            listener_model.from_data_model(i) for i in data_model.listeners
        ]
        result.pools = [
            pool_model.from_data_model(i) for i in data_model.pools
        ]

        if not result.provider:
            result.provider = "octavia"

        return result
예제 #12
0
class MemberResponse(BaseMemberType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    address = wtypes.wsattr(types.IPAddressType())
    protocol_port = wtypes.wsattr(wtypes.IntegerType())
    weight = wtypes.wsattr(wtypes.IntegerType())
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    project_id = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    monitor_address = wtypes.wsattr(types.IPAddressType())
    monitor_port = wtypes.wsattr(wtypes.IntegerType())

    @classmethod
    def from_data_model(cls, data_model, children=False):
        member = super(MemberResponse, cls).from_data_model(data_model,
                                                            children=children)
        return member
예제 #13
0
class LoadBalancerPOST(BaseLoadBalancerType):
    """Defines mandatory and optional attributes of a POST request."""

    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    vip_address = wtypes.wsattr(types.IPAddressType())
    vip_port_id = wtypes.wsattr(wtypes.UuidType())
    vip_subnet_id = wtypes.wsattr(wtypes.UuidType())
    vip_network_id = wtypes.wsattr(wtypes.UuidType())
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    listeners = wtypes.wsattr([listener.ListenerPOST], default=[])
예제 #14
0
class LoadBalancerPOST(BaseLoadBalancerType):
    """Defines mandatory and optional attributes of a POST request."""

    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    vip_address = wtypes.wsattr(types.IPAddressType())
    vip_port_id = wtypes.wsattr(wtypes.UuidType())
    vip_subnet_id = wtypes.wsattr(wtypes.UuidType())
    vip_network_id = wtypes.wsattr(wtypes.UuidType())
    vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    listeners = wtypes.wsattr([listener.ListenerSingleCreate], default=[])
    pools = wtypes.wsattr([pool.PoolSingleCreate], default=[])
    provider = wtypes.wsattr(wtypes.StringType(max_length=64))
    tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
    flavor_id = wtypes.wsattr(wtypes.UuidType())
예제 #15
0
class LoadBalancerPOST(BaseLoadBalancerType):
    """Defines mandatory and optional attributes of a POST request."""

    name = wtypes.wsattr(wtypes.StringType(max_length=255))
    description = wtypes.wsattr(wtypes.StringType(max_length=255))
    admin_state_up = wtypes.wsattr(bool, default=True)
    vip_address = wtypes.wsattr(types.IPAddressType())
    vip_port_id = wtypes.wsattr(wtypes.UuidType())
    vip_subnet_id = wtypes.wsattr(wtypes.UuidType())
    vip_network_id = wtypes.wsattr(wtypes.UuidType())
    vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
    project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
    listeners = wtypes.wsattr([listener.ListenerSingleCreate], default=[])
    pools = wtypes.wsattr([pool.PoolSingleCreate], default=[])
    provider = wtypes.wsattr(wtypes.StringType(max_length=64))
    # TODO(johnsom) This should be dynamic based on the loaded flavors
    #               once flavors are implemented.
    flavor_id = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_FLAVORS))
예제 #16
0
class MemberStatusResponse(BaseMemberType):
    """Defines which attributes are to be shown on status response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    address = wtypes.wsattr(types.IPAddressType())
    protocol_port = wtypes.wsattr(wtypes.IntegerType())

    @classmethod
    def from_data_model(cls, data_model, children=False):
        member = super(MemberStatusResponse,
                       cls).from_data_model(data_model, children=children)

        if not member.name:
            member.name = ""

        return member
예제 #17
0
class LoadBalancerResponse(BaseLoadBalancerType):
    """Defines which attributes are to be shown on any response."""
    id = wtypes.wsattr(wtypes.UuidType())
    name = wtypes.wsattr(wtypes.StringType())
    description = wtypes.wsattr(wtypes.StringType())
    provisioning_status = wtypes.wsattr(wtypes.StringType())
    operating_status = wtypes.wsattr(wtypes.StringType())
    admin_state_up = wtypes.wsattr(bool)
    project_id = wtypes.wsattr(wtypes.StringType())
    tenant_id = wtypes.wsattr(wtypes.StringType())
    created_at = wtypes.wsattr(wtypes.datetime.datetime)
    updated_at = wtypes.wsattr(wtypes.datetime.datetime)
    vip_address = wtypes.wsattr(types.IPAddressType())
    vip_port_id = wtypes.wsattr(wtypes.UuidType())
    vip_subnet_id = wtypes.wsattr(wtypes.UuidType())
    vip_network_id = wtypes.wsattr(wtypes.UuidType())
    listeners = wtypes.wsattr([MinimalListener])
    # TODO(ankur-gupta-f): add pools once that has been merged

    @classmethod
    def from_data_model(cls, data_model, children=False):
        result = super(BaseLoadBalancerType,
                       cls).from_data_model(data_model, children=children)
        if data_model.vip:
            result.vip_subnet_id = data_model.vip.subnet_id
            result.vip_port_id = data_model.vip.port_id
            result.vip_address = data_model.vip.ip_address
            result.vip_network_id = data_model.vip.network_id
        result.listeners = [
            MinimalListener.from_data_model(i) for i in data_model.listeners
        ]
        result.tenant_id = data_model.project_id
        if not result.description:
            result.description = ""
        if not result.name:
            result.name = ""

        return result
예제 #18
0
class VIP(base.BaseType):
    """Defines the response and acceptable POST request attributes."""
    ip_address = wtypes.wsattr(base.IPAddressType())
    port_id = wtypes.wsattr(wtypes.UuidType())
    subnet_id = wtypes.wsattr(wtypes.UuidType())
    network_id = wtypes.wsattr(wtypes.UuidType())
예제 #19
0
class SessionPersistenceResponse(types.BaseType):
    """Defines which attributes are to be shown on any response."""
    type = wtypes.wsattr(wtypes.text)
    cookie_name = wtypes.wsattr(wtypes.text)
    persistence_timeout = wtypes.wsattr(wtypes.IntegerType())
    persistence_granularity = wtypes.wsattr(types.IPAddressType())