当前位置: 首页>>代码示例>>Python>>正文


Python Transactional.__init__方法代码示例

本文整理汇总了Python中pyroute2.ipdb.transactional.Transactional.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Transactional.__init__方法的具体用法?Python Transactional.__init__怎么用?Python Transactional.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyroute2.ipdb.transactional.Transactional的用法示例。


在下文中一共展示了Transactional.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
 def __init__(self, ipdb, mode=None, parent=None, uid=None):
     '''
     Parameters:
     * ipdb -- ipdb() reference
     * mode -- transaction mode
     '''
     Transactional.__init__(self, ipdb, mode)
     self.cleanup = ('header',
                     'linkinfo',
                     'af_spec',
                     'attrs',
                     'event',
                     'map',
                     'stats',
                     'stats64',
                     '__align')
     self.ingress = None
     self.egress = None
     self.nlmsg = None
     self._exception = None
     self._tb = None
     self._load_event = threading.Event()
     self._linked_sets.add('ipaddr')
     self._linked_sets.add('ports')
     self._freeze = None
     # 8<-----------------------------------
     # local setup: direct state is required
     with self._direct_state:
         for i in self._fields:
             self[i] = None
         for i in ('change', 'mask'):
             del self[i]
         self['ipaddr'] = IPaddrSet()
         self['ports'] = LinkedSet()
         self['ipdb_priority'] = 0
开发者ID:thezeep,项目名称:pyroute2,代码行数:37,代码来源:interface.py

示例2: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
    def __init__(self, ipdb, mode=None, parent=None, uid=None):
        '''
        Parameters:
        * ipdb -- ipdb() reference
        * mode -- transaction mode
        '''
        Transactional.__init__(self, ipdb, mode)
        self.cleanup = ('header',
                        'linkinfo',
                        'af_spec',
                        'attrs',
                        'event',
                        'map',
                        'stats',
                        'stats64',
                        '__align')
        self.ingress = None
        self.egress = None
        self._exists = False
        self._flicker = False
        self._exception = None
        self._tb = None
        self._virtual_fields = ('removal', 'flicker', 'state')
        self._xfields = {'common': [ifinfmsg.nla2name(i[0]) for i
                                    in ifinfmsg.nla_map]}
        self._xfields['common'].append('index')
        self._xfields['common'].append('flags')
        self._xfields['common'].append('mask')
        self._xfields['common'].append('change')
        self._xfields['common'].append('kind')
        self._xfields['common'].append('peer')
        self._xfields['common'].append('vlan_id')
        self._xfields['common'].append('bond_mode')

        for data in ('bridge_data',
                     'bond_data',
                     'tuntap_data',
                     'vxlan_data',
                     'gre_data',
                     'macvlan_data',
                     'macvtap_data'):
            msg = getattr(ifinfmsg.ifinfo, data)
            self._xfields['common'].extend([msg.nla2name(i[0]) for i
                                            in msg.nla_map])
        for ftype in self._xfields:
            self._fields += self._xfields[ftype]
        self._fields.extend(self._virtual_fields)
        self._load_event = threading.Event()
        self._linked_sets.add('ipaddr')
        self._linked_sets.add('ports')
        self._freeze = None
        # 8<-----------------------------------
        # local setup: direct state is required
        with self._direct_state:
            self['ipaddr'] = IPaddrSet()
            self['ports'] = LinkedSet()
            for i in self._fields:
                self[i] = None
            for i in ('state', 'change', 'mask'):
                del self[i]
开发者ID:0x90,项目名称:pyroute2,代码行数:62,代码来源:interface.py

示例3: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
    def __init__(self, ipdb, mode=None, parent=None, uid=None):
        Transactional.__init__(self, ipdb, mode, parent, uid)
        self._load_event = threading.Event()
        self._fields = [rtmsg.nla2name(i[0]) for i in rtmsg.nla_map]
        self._fields.append('flags')
        self._fields.append('src_len')
        self._fields.append('dst_len')
        self._fields.append('table')
        self._fields.append('removal')
        self._virtual_fields = ['ipdb_scope', 'ipdb_priority']

        def make_set_value(self, key):
            def set_value(value):
                self[key] = value
                return self
            return set_value
        for key in self._fields + self._virtual_fields:
            setattr(self, 'set_%s' % key, make_set_value(self, key))
        self._fields.extend(self._virtual_fields)
        self.cleanup = ('attrs',
                        'header',
                        'event')
        with self._direct_state:
            for i in self._fields:
                self[i] = None
            self['metrics'] = Metrics(parent=self)
            self['ipdb_priority'] = 0
开发者ID:nazarewk,项目名称:pyroute2,代码行数:29,代码来源:route.py

示例4: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
 def __init__(self, ipdb, mode=None, parent=None, uid=None):
     Transactional.__init__(self, ipdb, mode, parent, uid)
     self._load_event = threading.Event()
     with self._direct_state:
         for i in self._fields:
             self[i] = None
         self['metrics'] = Metrics(parent=self)
         self['multipath'] = NextHopSet()
         self['ipdb_priority'] = 0
开发者ID:FirefighterBlu3,项目名称:pyroute2,代码行数:11,代码来源:route.py

示例5: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
 def __init__(self, ipdb, mode=None):
     Transactional.__init__(self, ipdb, mode)
     self._exists = False
     self._load_event = threading.Event()
     self._fields = [rtmsg.nla2name(i[0]) for i in rtmsg.nla_map]
     self._fields.append('flags')
     self._fields.append('src_len')
     self._fields.append('dst_len')
     self._fields.append('table')
     self._fields.append('removal')
     self.cleanup = ('attrs',
                     'header',
                     'event')
开发者ID:jazzmes,项目名称:pyroute2,代码行数:15,代码来源:route.py

示例6: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
 def __init__(self, ipdb, mode=None, parent=None, uid=None):
     Transactional.__init__(self, ipdb, mode, parent, uid)
     self._exists = False
     self._load_event = threading.Event()
     self._fields = [rtmsg.nla2name(i[0]) for i in rtmsg.nla_map]
     self._fields.append('flags')
     self._fields.append('src_len')
     self._fields.append('dst_len')
     self._fields.append('table')
     self._fields.append('removal')
     self.cleanup = ('attrs',
                     'header',
                     'event')
     with self._direct_state:
         self['metrics'] = Metrics(parent=self)
开发者ID:alexliyu,项目名称:ip-white-list-of-firewall,代码行数:17,代码来源:route.py

示例7: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
 def __init__(self, ipdb, mode=None, parent=None, uid=None):
     '''
     Parameters:
     * ipdb -- ipdb() reference
     * mode -- transaction mode
     '''
     Transactional.__init__(self, ipdb, mode)
     self.cleanup = ('header',
                     'linkinfo',
                     'protinfo',
                     'af_spec',
                     'attrs',
                     'event',
                     'map',
                     'stats',
                     'stats64',
                     'change',
                     '__align')
     self.ingress = None
     self.egress = None
     self.nlmsg = None
     self.errors = []
     self.partial = False
     self._exception = None
     self._tb = None
     self._linked_sets.add('ipaddr')
     self._linked_sets.add('ports')
     self._linked_sets.add('vlans')
     self._freeze = None
     self._delay_add_port = set()
     self._delay_del_port = set()
     # 8<-----------------------------------
     # local setup: direct state is required
     with self._direct_state:
         for i in ('change', 'mask'):
             del self[i]
         self['ipaddr'] = self.ipdb.init_ipaddr_set()
         self['ports'] = LinkedSet()
         self['vlans'] = LinkedSet()
         self['ipdb_priority'] = 0
开发者ID:craneworks,项目名称:pyroute2,代码行数:42,代码来源:interface.py

示例8: __init__

# 需要导入模块: from pyroute2.ipdb.transactional import Transactional [as 别名]
# 或者: from pyroute2.ipdb.transactional.Transactional import __init__ [as 别名]
 def __init__(self, ipdb, mode=None, parent=None, uid=None):
     Transactional.__init__(self, ipdb, mode, parent, uid)
     with self._direct_state:
         self['ipdb_priority'] = 0
开发者ID:celebdor,项目名称:pyroute2,代码行数:6,代码来源:rules.py


注:本文中的pyroute2.ipdb.transactional.Transactional.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。