Example #1
0
    def test_get_lldp_tlvs(self, lldp_nics):
        assert lldptool.is_lldp_enabled_on_iface(lldp_nics[0])
        assert lldptool.is_lldp_enabled_on_iface(lldp_nics[1])
        tlvs = lldptool.get_tlvs(lldp_nics[0])
        assert 3 == len(tlvs)
        expected_ttl_tlv = {
            'type': 3,
            'name': 'Time to Live',
            'properties': {'time to live': '120'},
        }
        assert expected_ttl_tlv == tlvs[-1]

        tlvs = lldptool.get_tlvs(lldp_nics[1])
        assert 3 == len(tlvs)
Example #2
0
    def test_get_lldp_tlvs(self):
        with veth_pair() as (nic1, nic2):
            iface(nic1).up()
            iface(nic2).up()
            with enable_lldp_on_ifaces((nic1, nic2), rx_only=False):
                self.assertTrue(lldptool.is_lldp_enabled_on_iface(nic1))
                self.assertTrue(lldptool.is_lldp_enabled_on_iface(nic2))
                tlvs = lldptool.get_tlvs(nic1)
                self.assertEqual(3, len(tlvs))
                expected_ttl_tlv = {
                    'type': 3,
                    'name': 'Time to Live',
                    'properties': {
                        'time to live': '120'
                    }
                }
                self.assertEqual(expected_ttl_tlv, tlvs[-1])

                tlvs = lldptool.get_tlvs(nic2)
                self.assertEqual(3, len(tlvs))
Example #3
0
    def test_get_lldp_tlvs(self):
        with veth_pair() as (nic1, nic2):
            iface(nic1).up()
            iface(nic2).up()
            with enable_lldp_on_ifaces((nic1, nic2), rx_only=False):
                assert lldptool.is_lldp_enabled_on_iface(nic1)
                assert lldptool.is_lldp_enabled_on_iface(nic2)
                tlvs = lldptool.get_tlvs(nic1)
                assert 3 == len(tlvs)
                expected_ttl_tlv = {
                    'type': 3,
                    'name': 'Time to Live',
                    'properties': {
                        'time to live': '120'
                    },
                }
                assert expected_ttl_tlv == tlvs[-1]

                tlvs = lldptool.get_tlvs(nic2)
                assert 3 == len(tlvs)
Example #4
0
    def test_get_lldp_tlvs(self):
        with veth_pair() as (nic1, nic2):
            iface(nic1).up()
            iface(nic2).up()
            with enable_lldp_on_ifaces((nic1, nic2), rx_only=False):
                self.assertTrue(lldptool.is_lldp_enabled_on_iface(nic1))
                self.assertTrue(lldptool.is_lldp_enabled_on_iface(nic2))
                tlvs = lldptool.get_tlvs(nic1)
                self.assertEqual(3, len(tlvs))
                expected_ttl_tlv = {
                    'type': 3,
                    'name': 'Time to Live',
                    'properties': {
                        'time to live': '120'
                    }
                }
                self.assertEqual(expected_ttl_tlv, tlvs[-1])

                tlvs = lldptool.get_tlvs(nic2)
                self.assertEqual(3, len(tlvs))
Example #5
0
 def is_lldp_enabled_on_iface(iface):
     return lldptool.is_lldp_enabled_on_iface(iface)
Example #6
0
File: lldpad.py Project: nirs/vdsm
 def is_lldp_enabled_on_iface(iface):
     return lldptool.is_lldp_enabled_on_iface(iface)