本文整理匯總了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())