elif state_str == 'query-running':
return cls.QUERY_RUNNING
-
class ifaceJsonEncoder(json.JSONEncoder):
def default(self, o):
retconfig = {}
'config' : retconfig})
class iface():
- """ config flags """
- AUTO = 0x1
- HOT_PLUG = 0x2
+ """ flags """
+ # flag to indicate that the object was created from pickled state
+ PICKLED = 0x1
version = '0.1'
self.config_status = {}
self.state = ifaceState.NEW
self.status = ifaceStatus.UNKNOWN
- self.errstr = ''
self.flags = 0x0
self.priv_flags = 0x0
self.refcnt = 0
self.auto = False
self.classes = []
self.env = None
- self.config_current = {}
self.raw_lines = []
self.linkstate = None
else:
return True
- def set_config_current(self, config_current):
- self.config_current = config_current
-
- def get_config_current(self):
- return self.config_current
-
def get_auto(self):
return self.auto
def belongs_to_class(self, intfclass):
if intfclass in self.classes:
return True
-
return False
def set_priv_flags(self, priv_flags):
def set_status(self, status):
self.status = status
+ def set_state_n_status(self, state, status):
+ self.state = state
+ self.status = status
+
def state_str_to_hex(self, state_str):
return self.state_str_map.get(state_str)
del odict['state']
del odict['status']
del odict['lowerifaces']
+ del odict['upperifaces']
del odict['refcnt']
-
+ del odict['config_status']
+ del odict['flags']
+ del odict['priv_flags']
+ del odict['raw_lines']
+ del odict['linkstate']
+ del odict['env']
return odict
def __setstate__(self, dict):
self.__dict__.update(dict)
+ self.config_status = {}
self.state = ifaceState.NEW
self.status = ifaceStatus.UNKNOWN
self.refcnt = 0
+ self.flags = 0
self.lowerifaces = None
+ self.upperifaces = None
self.linkstate = None
+ self.env = None
+ self.priv_flags = 0
+ self.raw_lines = []
+ self.flags |= self.PICKLED
def dump_raw(self, logger):
indent = ' '
logger.info(self.get_name() + ' : {')
logger.info(indent + 'family: %s' %self.get_addr_family())
logger.info(indent + 'method: %s' %self.get_addr_method())
+ logger.info(indent + 'flags: %x' %self.flags)
logger.info(indent + 'state: %s'
%ifaceState.to_str(self.get_state()))
logger.info(indent + 'status: %s'
%ifaceStatus.to_str(self.get_status()))
logger.info(indent + 'refcnt: %d' %self.get_refcnt())
- d = self.get_lowerdevs()
+ d = self.get_lowerifaces()
if d:
logger.info(indent + 'lowerdevs: %s' %str(d))
else: