Esempio n. 1
0
    def get_bond(self, switch, bond_number):
        """
        Displays informations about a bond

        :arg str hostname: Hostname or IP of the switch
        :code 200 OK:

        Example output:

        .. literalinclude:: ../doc_config/api_samples/get_switch_hostname_bond_v2.json
            :language: json

        """

        return 200, bond.to_api(
            switch.get_bond(bond_number),
            version=request.headers.get("Netman-Max-Version"))
Esempio n. 2
0
    def get_bond(self, switch, bond_number):
        """
        Displays informations about a bond

        :arg str hostname: Hostname or IP of the switch
        :code 200 OK:

        Example output:

        .. literalinclude:: ../doc_config/api_samples/get_switch_hostname_bond_v2.json
            :language: json

        """

        return 200, bond.to_api(
            switch.get_bond(bond_number),
            version=request.headers.get("Netman-Max-Version"))
Esempio n. 3
0
    def get_bonds(self, switch):
        """
        Displays informations about all bonds

        :arg str hostname: Hostname or IP of the switch
        :code 200 OK:

        Example output:

        .. literalinclude:: ../doc_config/api_samples/get_switch_hostname_bonds_v2.json
            :language: json

        """
        bonds = sorted(switch.get_bonds(), key=lambda x: x.number)

        return 200, [bond.to_api(
            b, version=request.headers.get("Netman-Max-Version")
        ) for b in bonds]
Esempio n. 4
0
    def get_bonds(self, switch):
        """
        Displays informations about all bonds

        :arg str hostname: Hostname or IP of the switch
        :code 200 OK:

        Example output:

        .. literalinclude:: ../doc_config/api_samples/get_switch_hostname_bonds_v2.json
            :language: json

        """
        bonds = sorted(switch.get_bonds(), key=lambda x: x.number)

        return 200, [
            bond.to_api(b, version=request.headers.get("Netman-Max-Version"))
            for b in bonds
        ]