Beispiel #1
0
 def test_value_to_index(self):
     obj = DummyObject(13)
     obj.base = 'aa:00:0'
     pool = MacPrefixPool(obj)
     index = pool.value_to_index('aa:bc:ee')
     val = pool.index_to_value(index)
     self.assertEqual(val, 'aa:bc:ee')
Beispiel #2
0
 def test_value_to_index(self):
     obj = DummyObject(13)
     obj.base = 'aa:00:0'
     pool = MacPrefixPool(obj)
     index = pool.value_to_index('aa:bc:ee')
     val = pool.index_to_value(index)
     self.assertEqual(val, 'aa:bc:ee')
Beispiel #3
0
 def test_mac_prefix_conversion(self):
     obj = DummyObject(13)
     obj.base = 'aa:00:0'
     pool = MacPrefixPool(obj)
     for i in range(1, 9):
         self.assertEqual("aa:00:%s" % i, pool.get())
Beispiel #4
0
 def test_invalid_mac_reservation(self):
     obj = DummyObject(65636)
     obj.base = 'ab:ff:ff'
     pool = MacPrefixPool(obj)
     for i in range(0, 65535):
         self.assertEqual(pool.is_available(i, index=True), False)
Beispiel #5
0
 def test_mac_prefix_conversion(self):
     obj = DummyObject(13)
     obj.base = 'aa:00:0'
     pool = MacPrefixPool(obj)
     for i in range(1, 9):
         self.assertEqual("aa:00:%s" % i, pool.get())
Beispiel #6
0
 def test_invalid_mac_reservation(self):
     obj = DummyObject(65636)
     obj.base = 'ab:ff:ff'
     pool = MacPrefixPool(obj)
     for i in range(0, 65536):
         self.assertEqual(pool.is_available(i, index=True), False)