def get_vlan(self, switch, vlan_number): """ Displays informations about one VLAN :arg str hostname: Hostname or IP of the switch :arg int vlan_number: Vlan number, between 1 and 4096 :code 200 OK: Example output: .. literalinclude:: ../doc_config/api_samples/get_switch_hostname_vlans_vlan.json :language: json """ return 200, vlan.to_api(switch.get_vlan(vlan_number))
def get_vlans(self, switch): """ Displays informations about all VLANs :arg str hostname: Hostname or IP of the switch :code 200 OK: Example output: .. literalinclude:: ../doc_config/api_samples/get_switch_hostname_vlans.json :language: json """ vlans = sorted(switch.get_vlans(), key=lambda x: x.number) return 200, [vlan.to_api(v) for v in vlans]