Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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))
Esempio n. 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)
Esempio n. 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))
Esempio n. 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)