示例#1
0
    def facts(self):
        if self._facts is None:
            if hasattr(self.native, "_facts"):
                del self.native._facts

            self._facts = strip_unicode(self.native.facts)
            self._facts["vendor"] = self.vendor
        return self._facts
示例#2
0
    def facts(self):
        if hasattr(self, '_facts'):
            return self._facts

        facts = strip_unicode(self.native.facts)
        facts['vendor'] = self.vendor

        self._facts = facts
        return self._facts
示例#3
0
    def get(self, vlan_id):
        vlan_not_in_range_error(vlan_id)

        vlan_id = str(vlan_id)
        native_vlan_response = self.native_vlans.get(vlan_id)
        converted = convert_dict_by_key(native_vlan_response, VLAN_KM)
        converted['id'] = vlan_id

        return strip_unicode(converted)
示例#4
0
    def facts(self):
        if hasattr(self, '_facts'):
            return self._facts

        facts = strip_unicode(self.native.facts)
        facts['vendor'] = self.vendor

        self._facts = facts
        return self._facts
示例#5
0
    def get(self, vlan_id):
        vlan_not_in_range_error(vlan_id)

        vlan_id = str(vlan_id)
        native_vlan_response = self.native_vlans.get(vlan_id)
        converted = convert_dict_by_key(native_vlan_response, VLAN_KM)
        converted['id'] = vlan_id

        return strip_unicode(converted)
示例#6
0
    def show_list(self, commands, raw_text=False):
        if raw_text:
            encoding = "text"
        else:
            encoding = "json"

        try:
            return strip_unicode(
                self._parse_response(self.native.enable(commands, encoding=encoding), raw_text=raw_text)
            )
        except EOSCommandError as e:
            raise CommandListError(commands, e.commands[len(e.commands) - 1], e.message)
示例#7
0
    def show_list(self, commands, raw_text=False):
        if raw_text:
            encoding = 'text'
        else:
            encoding = 'json'

        try:
            return strip_unicode(
                self._parse_response(
                    self.native.enable(
                        commands, encoding=encoding), raw_text=raw_text))
        except EOSCommandError as e:
            raise CommandListError(commands,
                                   e.commands[len(e.commands) - 1],
                                   e.message)
示例#8
0
 def show_list(self, commands, raw_text=False):
     try:
         return strip_unicode(self.native.show_list(commands, raw_text=raw_text))
     except CLIError as e:
         raise CommandListError(commands, e.command, str(e))
示例#9
0
    def get_list(self):
        native_all_vlan_response = self.native_vlans.getall()
        extracted_vlan_ids = sorted(list(native_all_vlan_response.keys()))

        return strip_unicode(extracted_vlan_ids)
示例#10
0
 def show_list(self, commands, raw_text=False):
     try:
         return strip_unicode(
             self.native.show_list(commands, raw_text=raw_text))
     except CLIError as e:
         raise CommandListError(commands, e.command, str(e))
示例#11
0
    def get_list(self):
        native_all_vlan_response = self.native_vlans.getall()
        extracted_vlan_ids = sorted(list(native_all_vlan_response.keys()))

        return strip_unicode(extracted_vlan_ids)