本文整理汇总了Python中translator.base.simpletype.SimpleType.get_cli方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleType.get_cli方法的具体用法?Python SimpleType.get_cli怎么用?Python SimpleType.get_cli使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类translator.base.simpletype.SimpleType
的用法示例。
在下文中一共展示了SimpleType.get_cli方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_cli
# 需要导入模块: from translator.base.simpletype import SimpleType [as 别名]
# 或者: from translator.base.simpletype.SimpleType import get_cli [as 别名]
def create_cli(self, config, state):
''' Create the CLI using the config and the state '''
if state == State.NOCHANGE:
return ''
if not config:
return ''
result = AdvancedThreatDetection.THREAT_DETECTION_STATISTICS
if state == State.DESTROY:
if self.parent.is_audit():
if self.parent.statistics_exists('statistics'):
return None
return 'no ' + AdvancedThreatDetection.THREAT_DETECTION_STATISTICS + ' ' + self.stat_type
status = 'enable'
try:
if isinstance(config, dict):
status = config.get('status')
else:
return ''
except KeyError:
return SimpleType.get_cli(self)
if status and status.startswith('disable'):
return 'no ' + AdvancedThreatDetection.THREAT_DETECTION_STATISTICS + ' ' + self.stat_type
result += ' ' + self.stat_type
rate = config.get('number_of_rate')
if rate:
result += ' number-of-rate ' + str(rate)
return result
示例2: get_cli
# 需要导入模块: from translator.base.simpletype import SimpleType [as 别名]
# 或者: from translator.base.simpletype.SimpleType import get_cli [as 别名]
def get_cli(self):
'''
Generate the CLI for this single CLI with optional parameter 'reset'
'''
assert self.has_ifc_delta_cfg()
config = util.normalize_param_dict(self.delta_ifc_cfg_value['value'])
reset_option = (config.get('idle_reset') == 'enable') if config is not None else False # default value for reset: disable
reset_option = ' ' + TIMEOUT_RESET_CLI if reset_option else ''
return SimpleType.get_cli(self) + reset_option
示例3: get_cli
# 需要导入模块: from translator.base.simpletype import SimpleType [as 别名]
# 或者: from translator.base.simpletype.SimpleType import get_cli [as 别名]
def get_cli(self):
"""Generate the CLI for this single failover ip config.
"""
assert self.has_ifc_delta_cfg()
config = util.normalize_param_dict(self.delta_ifc_cfg_value["value"])
netmask = config.get("netmask") if ":" not in config.get("active_ip") else ""
standby_ip = config.get("standby_ip")
result = SimpleType.get_cli(self)
result += " " + netmask + " standby " + standby_ip
return " ".join(result.split())
示例4: get_cli
# 需要导入模块: from translator.base.simpletype import SimpleType [as 别名]
# 或者: from translator.base.simpletype.SimpleType import get_cli [as 别名]
def get_cli(self):
'''Generate the CLI for this single cluster ip config.
'''
assert self.has_ifc_delta_cfg()
config = util.normalize_param_dict(self.delta_ifc_cfg_value['value'])
mask = config.get('mask')
result = SimpleType.get_cli(self)
if mask:
result += ' mask ' + mask
return ' '.join(result.split())