コード例 #1
0
    def __init__(self, c, context, pool, old_pool=None, deprecated_arg=None):
        self.c = c
        self.context = context
        self.pool = pool
        self.c_pers = None
        self.s_pers = None
        # self.old_pool = old_pool

        self.sp_obj_dict = {
            'HTTP_COOKIE': "cookie_persistence",
            'APP_COOKIE': "cookie_persistence",
            'SOURCE_IP': "src_ip_persistence",
        }

        if pool:
            self.name = pool.id

        if pool and pool.session_persistence:
            self.sp = pool.session_persistence
            if self.sp.type == 'HTTP_COOKIE' or self.sp.type == 'APP_COOKIE':
                self.c_pers = self.name
            elif self.sp.type == 'SOURCE_IP':
                self.s_pers = self.name
            else:
                raise a10_ex.UnsupportedFeature()
        else:
            self.sp = None
コード例 #2
0
    def create(self):
        methods = {
            'HTTP_COOKIE':
            self.c.client.slb.template.cookie_persistence.create,
            'SOURCE_IP': self.c.client.slb.template.src_ip_persistence.create,
        }
        if self.sp.type in methods:
            try:
                methods[self.sp.type](self.name)
            except acos_errors.Exists:
                pass
        else:
            raise a10_ex.UnsupportedFeature()

        if self.pool.listener:
            self.pool_handler.a10_driver.listener._update(
                self.c, self.context, self.pool.listener)
コード例 #3
0
    def _persistence_get(self, c, context, listener):
        if (not listener.default_pool
                or not listener.default_pool.sessionpersistence):
            return [None, None]

        sp = listener.default_pool.sessionpersistence
        name = listener.default_pool.id
        c_pers = None
        s_pers = None

        if sp.type == 'HTTP_COOKIE':
            c_pers = name
        elif sp.type == 'SOURCE_IP':
            s_pers = name
        else:
            raise a10_ex.UnsupportedFeature()

        return [c_pers, s_pers]
コード例 #4
0
    def __init__(self, c, context, vip, vip_name):
        self.c = c
        self.context = context
        self.vip = vip
        self.c_pers = None
        self.s_pers = None
        self.name = vip_name

        if vip.get('session_persistence', None) is not None:
            self.sp = vip['session_persistence']
            if self.sp['type'] == 'HTTP_COOKIE':
                self.c_pers = self.name
            elif self.sp['type'] == 'SOURCE_IP':
                self.s_pers = self.name
            else:
                raise a10_ex.UnsupportedFeature()
        else:
            self.sp = None
コード例 #5
0
    def __init__(self, c, context, pool, deprecated_arg=None):
        self.c = c
        self.context = context
        self.pool = pool
        self.c_pers = None
        self.s_pers = None

        if pool:
            self.name = pool.id

        if pool and pool.sessionpersistence:
            self.sp = pool.sessionpersistence
            if self.sp.type == 'HTTP_COOKIE' or self.sp.type == 'APP_COOKIE':
                self.c_pers = self.name
            elif self.sp.type == 'SOURCE_IP':
                self.s_pers = self.name
            else:
                raise a10_ex.UnsupportedFeature()
        else:
            self.sp = None
コード例 #6
0
    def __init__(self, c, context, vip, vip_name, old_vip=None):
        self.c = c
        self.context = context
        self.vip = vip
        self.c_pers = None
        self.s_pers = None
        self.name = vip_name
        self.old_vip = old_vip

        self.sp_obj_dict = {
            'HTTP_COOKIE': "cookie_persistence",
            'SOURCE_IP': "src_ip_persistence",
        }

        self.sp = vip.get("session_persistence")

        if self.sp is not None:
            if self.sp['type'] == 'HTTP_COOKIE':
                self.c_pers = self.name
            elif self.sp['type'] == 'SOURCE_IP':
                self.s_pers = self.name
            else:
                raise a10_ex.UnsupportedFeature()
コード例 #7
0
 def refresh(self, context, lb_obj, force=False):
     raise a10_ex.UnsupportedFeature()