def test_tunnel_output(self):
     max_tunnel_id = 1024
     for test_value in range(1, max_tunnel_id + 1):
         with self.subTest((test_value, 'vxlan')):
             test_result = 2080374784 + test_value
             args = {'tunnel_type': 'vxlan'}
             args['interface'] = 'tunnel {}'.format(test_value)
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     for test_value in range(1, max_tunnel_id + 1):
         with self.subTest((test_value, 'gre')):
             test_result = 2084569088 + test_value
             args = {'tunnel_type': 'gre'}
             args['interface'] = 'tunnel {}'.format(test_value)
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     for test_value in range(1, max_tunnel_id + 1):
         with self.subTest((test_value, 'nvgre')):
             test_result = 2088763392 + test_value
             args = {'tunnel_type': 'nvgre'}
             args['interface'] = 'tunnel {}'.format(test_value)
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     for test_value in range(1, max_tunnel_id + 1):
         with self.subTest((test_value, 'mpls')):
             test_result = 2092957696 + test_value
             args = {'tunnel_type': 'mpls'}
             args['interface'] = 'tunnel {}'.format(test_value)
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     return
 def test_49to54_breakout_port_output(self):
     args = {'speed': '100g', 'interface': 'e 0/49'}
     dummy = Slx9030_IfIndex(**args)
     intf_string = '000011'
     speed_string = dummy.speed_map.map('25g')
     interfaces = [
         x.physical for x in dummy.mapping.interfaces if x.breakout
     ]
     slot = 0
     slot_string = self.bit_mapper(slot, 5)
     for interface in interfaces:
         for breakout in range(1, 5):
             sub_port = self.bit_mapper(breakout, 4)
             test_value = 'e {}/{}:{}'.format(slot, interface, breakout)
             port_data = dummy.mapping.get_interface(interface)
             bit_map = (intf_string + slot_string +
                        self.bit_mapper(interface, 8) + sub_port +
                        speed_string +
                        self.bit_mapper(port_data.chip_num, 6))
             test_result = IfIndex(bit_map)
             with self.subTest(test_value):
                 args = {'speed': '25g'}
                 args['interface'] = '{}'.format(test_value)
                 result = Slx9030_IfIndex(**args)
                 self.assertEqual(result.if_index.Decimal,
                                  test_result.Decimal)
     speed_string = dummy.speed_map.map('10g')
     interfaces = [
         x.physical for x in dummy.mapping.interfaces if x.breakout
     ]
     slot_string = self.bit_mapper(slot, 5)
     for interface in interfaces:
         for breakout in range(1, 5):
             sub_port = self.bit_mapper(breakout, 4)
             test_value = 'e {}/{}:{}'.format(slot, interface, breakout)
             port_data = dummy.mapping.get_interface(interface)
             bit_map = (intf_string + slot_string +
                        self.bit_mapper(interface, 8) + sub_port +
                        speed_string +
                        self.bit_mapper(port_data.chip_num, 6))
             test_result = IfIndex(bit_map)
             with self.subTest(test_value):
                 args = {'speed': '10g'}
                 args['interface'] = '{}'.format(test_value)
                 result = Slx9030_IfIndex(**args)
                 self.assertEqual(result.if_index.Decimal,
                                  test_result.Decimal)
     return
 def test_mgmt_output(self):
     for test_value, test_result in [[0, 805306368]]:
         with self.subTest(test_value):
             args = {'interface': 'm {}'.format(test_value)}
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     return
 def test_loopback_output(self):
     for test_value in range(1, 256):
         with self.subTest(test_value):
             test_result = 1476395008 + test_value
             args = {'interface': 'lo {}'.format(test_value)}
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     return
 def test_port_channel_output(self):
     for test_value in range(1, 256):
         with self.subTest(test_value):
             test_result = 671088640 + test_value
             args = {'interface': 'po {}'.format(test_value)}
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     return
 def test_ve_output(self):
     max_ve_id = 4096
     for test_value in range(1, max_ve_id + 1):
         with self.subTest((test_value)):
             test_result = 1207959552 + test_value
             args = {'interface': 've {}'.format(test_value)}
             result = Slx9030_IfIndex(**args)
             self.assertEqual(result.if_index.Decimal, test_result)
     return