當前位置: 首頁>>代碼示例>>Python>>正文


Python SimpleType.parse_multi_parameter_cli方法代碼示例

本文整理匯總了Python中translator.base.simpletype.SimpleType.parse_multi_parameter_cli方法的典型用法代碼示例。如果您正苦於以下問題:Python SimpleType.parse_multi_parameter_cli方法的具體用法?Python SimpleType.parse_multi_parameter_cli怎麽用?Python SimpleType.parse_multi_parameter_cli使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在translator.base.simpletype.SimpleType的用法示例。


在下文中一共展示了SimpleType.parse_multi_parameter_cli方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse_multi_parameter_cli

# 需要導入模塊: from translator.base.simpletype import SimpleType [as 別名]
# 或者: from translator.base.simpletype.SimpleType import parse_multi_parameter_cli [as 別名]
    def parse_multi_parameter_cli(self, cli):
        """
        Override the default implementation in case the CLI does not match asa_gen_template due to optional parameter
        """
        # Take care of the mandatory parameters
        result = SimpleType.parse_multi_parameter_cli(self, cli, alternate_asa_gen_template=self.asa_gen_template)

        "Take care of the optional parameters"
        tokens = cli.split()

        # The number of tokens must greater than 3, i.e. 'failover interface ip ...'
        assert len(tokens) > 3

        for name in ["interface_name", "active_ip", "standby_ip"]:
            result[(Type.PARAM, name, "")] = {"state": State.NOCHANGE, "value": ""}
        option = tokens[3:]
        # for ipv4, option is: %(interface_name)s %(active_ip)s %(netmask)s standby %(standby_ip)s
        # for ipv6, option is: %(interface_name)s %(active_ip)s standby %(standby_ip)s
        result[Type.PARAM, "interface_name", ""]["value"] = option[0]
        result[Type.PARAM, "active_ip", ""]["value"] = option[1]
        if ":" not in option[1]:  # ipv4
            result[(Type.PARAM, "netmask", "")] = {"state": State.NOCHANGE, "value": ""}
            result[Type.PARAM, "netmask", ""]["value"] = option[2]
            # skip option[3], which should be the 'standby' keyword
            result[Type.PARAM, "standby_ip", ""]["value"] = option[4]
        else:  # ipv6, no netmask
            # skip option[2], which should be the 'standby' keyword
            result[Type.PARAM, "standby_ip", ""]["value"] = option[3]
        return result
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:31,代碼來源:failover.py

示例2: parse_multi_parameter_cli

# 需要導入模塊: from translator.base.simpletype import SimpleType [as 別名]
# 或者: from translator.base.simpletype.SimpleType import parse_multi_parameter_cli [as 別名]
 def parse_multi_parameter_cli(self, cli, alternate_asa_gen_template = None):
     '''
     Override the default implementation in case the CLI does not match asa_gen_template due to optional parameter
     '''
     if not cli.endswith(AdvancedThreatDetection.THREAT_DETECTION_STATISTICS_TCP_INTERCEPT):
         return SimpleType.parse_multi_parameter_cli(self, cli, alternate_asa_gen_template)
     return self.parse_intercept_cli(cli)
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:9,代碼來源:advanced_threat_detect.py

示例3: parse_multi_parameter_cli

# 需要導入模塊: from translator.base.simpletype import SimpleType [as 別名]
# 或者: from translator.base.simpletype.SimpleType import parse_multi_parameter_cli [as 別名]
    def parse_multi_parameter_cli(self, cli):
        '''Override the default implementation in case the CLI does not have optional max_retries value
        '''
        # Take care of the optional parameters
        tokens = cli.split()

        if len(tokens) < len(self.asa_gen_template.split()):
            cli += ' ' + MAX_RETRIES_DEFAULT

        return SimpleType.parse_multi_parameter_cli(self, cli, alternate_asa_gen_template = self.asa_gen_template)
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:12,代碼來源:connection_limits.py

示例4: parse_multi_parameter_cli

# 需要導入模塊: from translator.base.simpletype import SimpleType [as 別名]
# 或者: from translator.base.simpletype.SimpleType import parse_multi_parameter_cli [as 別名]
    def parse_multi_parameter_cli(self, cli):
        '''
        Override the default implementation in case the CLI does not match asa_gen_template due to optional parameter
        '''
        # Take care of the mandatory parameters
        result = SimpleType.parse_multi_parameter_cli(self, cli, alternate_asa_gen_template = self.asa_gen_template)

        'Take care of the optional parameters'
        tokens = cli.split()

        # The number of tokens must greater than 3, i.e. 'clacp system-mac [H.H.H | auto]'
        assert len(tokens) > 3

        option = tokens[3:]
        if len(option) > 0:
            result[(Type.PARAM, 'system-priority', '')] = {'state': State.NOCHANGE, 'value': ''}
            result[Type.PARAM, 'system-priority', '']['value'] = option[0]
        return result
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:20,代碼來源:cluster.py

示例5: parse_multi_parameter_cli

# 需要導入模塊: from translator.base.simpletype import SimpleType [as 別名]
# 或者: from translator.base.simpletype.SimpleType import parse_multi_parameter_cli [as 別名]
    def parse_multi_parameter_cli(self, cli):
        '''Override the default implementation in case the CLI does not match asa_gen_template due to optional
        parameter
        '''
        'Take care of the mandatory parameters'
        result = SimpleType.parse_multi_parameter_cli(self, cli, alternate_asa_gen_template = 'ipv6 route %(interface)s %(prefix)s %(gateway)s')

        'Take care of the optional parameters'
        for name, value  in self.defaults.iteritems():
            result[(Type.PARAM, name, '')] = {'state': State.NOCHANGE, 'value': value}
        tokens = cli.split()
        if len(tokens) == 5:
            return result #no optional parameter

        option = tokens[5]
        if option == 'tunneled':
            result[Type.PARAM, 'tunneled', '']['value'] = option
        elif option:
            result[Type.PARAM, 'hop_count', '']['value'] = option

        return result
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:23,代碼來源:static_route.py


注:本文中的translator.base.simpletype.SimpleType.parse_multi_parameter_cli方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。