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


Python SimpleType.parse_multi_parameter_cli方法代碼示例

本文整理匯總了Python中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使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在base.simpletype.SimpleType的用法示例。


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

示例1: parse_multi_parameter_cli

# 需要導入模塊: from base.simpletype import SimpleType [as 別名]
# 或者: from 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
     '''
     result = SimpleType.parse_multi_parameter_cli(self, cli)
     if not result:
         result = SimpleType.parse_multi_parameter_cli(self, cli,
                                                       alternate_asa_gen_template = ' '.join(self.asa_gen_template.split()[:3]))
     return result
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:11,代碼來源:service_object_group.py

示例2: parse_multi_parameter_cli

# 需要導入模塊: from base.simpletype import SimpleType [as 別名]
# 或者: from base.simpletype.SimpleType import parse_multi_parameter_cli [as 別名]
    def parse_multi_parameter_cli(self, cli):
        # 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 2, i.e. 'ipv6 address prefix or default'
        assert len(tokens) > 2

        if ' at ' in cli:
            colon_index_list = [a for a,b in enumerate(tokens) if ':' in b]
            d1 = self.get_date_without_year(' '.join(tokens[5:colon_index_list[0]+1]))
            d2 = self.get_date_without_year(' '.join(tokens[(colon_index_list[0] + 1):colon_index_list[1]+1]))

            result[(Type.PARAM, 'valid_lifetime_in_date', '')] = {'state': State.NOCHANGE, 'value': d1}
            result[(Type.PARAM, 'prefered_lifetime_in_date', '')] = {'state': State.NOCHANGE, 'value': d2}
        elif len(tokens) > 5 and (tokens[4].isdigit() or tokens[4] == 'infinite') and \
            (tokens[5].isdigit() or tokens[5] == 'infinite'):
            s1 = 'valid_lifetime_in_seconds' if tokens[5].isdigit() else 'valid_lifetime_never_expire'
            s2 = 'prefered_lifetime_in_seconds' if tokens[5].isdigit() else 'prefered_lifetime_never_expire'
            result[(Type.PARAM, s1, '')] = {'state': State.NOCHANGE, 'value': tokens[4]}
            result[(Type.PARAM, s2, '')] = {'state': State.NOCHANGE, 'value': tokens[5]}
        if 'no-advertise' in cli:
            result[(Type.PARAM, 'no_advertise', '')] = {'state': State.NOCHANGE, 'value': 'enable'}
        else:
            if 'off-link' in cli:
                result[(Type.PARAM, 'off-link', '')] = {'state': State.NOCHANGE, 'value': 'enable'}
            if 'no-autoconfig' in cli:
                result[(Type.PARAM, 'no-autoconfig', '')] = {'state': State.NOCHANGE, 'value': 'enable'}
        return result
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:33,代碼來源:interface_config.py

示例3: parse_multi_parameter_cli

# 需要導入模塊: from base.simpletype import SimpleType [as 別名]
# 或者: from base.simpletype.SimpleType import parse_multi_parameter_cli [as 別名]
 def parse_multi_parameter_cli(self, cli):
     result = SimpleType.parse_multi_parameter_cli(self, cli, alternate_asa_gen_template = self.asa_gen_template)
     tokens = cli.split()
     if len(tokens) == 3:
         return result # no optional parameter
     result[(Type.PARAM, 'peer_mac', '')] = {'state': State.NOCHANGE, 'value': ''}
     option = tokens[3:]
     if 'mac' in option: # e.g. "peer ip 10.10.10.10 mac 1234.5678.9abc"
         result[Type.PARAM, 'peer_mac', '']['value'] = option[1]
     return result
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:12,代碼來源:vxlan_nve.py

示例4: parse_multi_parameter_cli

# 需要導入模塊: from base.simpletype import SimpleType [as 別名]
# 或者: from 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 mandatory parameters is 3, i.e. 'ntp server 1.1.1.1'
        if len(tokens) == 3:
            return result  # no optional parameter

        for name in ["key", "prefer"]:
            result[(Type.PARAM, name, "")] = {"state": State.NOCHANGE, "value": ""}

        option = tokens[3:]
        if "key" in option:  # e.g. "ntp server 1.1.1.1 key 11
            result[Type.PARAM, "key", ""]["value"] = option[1]
        if "prefer" in option:  # e.g. "ntp server 1.1.1.1 prefer
            result[Type.PARAM, "prefer", ""]["value"] = "enable"
        return result
開發者ID:AlexFengCisco,項目名稱:ACI_REST_Project,代碼行數:25,代碼來源:ntp.py


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