Example #1
0
 def test_full(self, super_init, isd_as, parse):
     intf_dict = {
         'Overlay': 'UDP/IPv4',
         'PublicOverlay': {
             'Addr': 'addr',
             'OverlayPort': 6
         },
         'RemoteOverlay': {
             'Addr': 'toaddr',
             'OverlayPort': 5
         },
         'Bandwidth': 1001,
         'ISD_AS': '3-ff00:0:301',
         'LinkTo': 'PARENT',
         'MTU': 4242
     }
     if_id = 1
     addrs = {'IPv4': {'PublicOverlay': {'Addr': 'addr', 'OverlayPort': 6}}}
     # Call
     inst = InterfaceElement(if_id, intf_dict, 'name')
     # Tests
     super_init.assert_called_once_with(inst, addrs, 'name')
     ntools.eq_(inst.if_id, 1)
     ntools.eq_(inst.isd_as, isd_as.return_value)
     ntools.eq_(inst.link_type, "parent")
     ntools.eq_(inst.bandwidth, 1001)
     ntools.eq_(inst.mtu, 4242)
     ntools.eq_(inst.overlay, "UDP/IPv4")
     parse.assert_called_once_with("toaddr")
     ntools.eq_(inst.remote, (parse.return_value, 5))
Example #2
0
 def test_full(self, super_init, isd_as, parse):
     intf_dict = {
         'InternalAddrIdx': 0,
         'Overlay': 'UDP/IPv4',
         'Public': {
             'Addr': 'addr',
             'L4Port': 6
         },
         'Remote': {
             'Addr': 'toaddr',
             'L4Port': 5
         },
         'Bandwidth': 1001,
         'ISD_AS': '3-2',
         'LinkType': 'PARENT',
         'MTU': 4242
     }
     if_id = 1
     public = {'Addr': 'addr', 'L4Port': 6}
     # Call
     inst = InterfaceElement(if_id, intf_dict, 'name')
     # Tests
     super_init.assert_called_once_with(inst, public, None, 'name')
     ntools.eq_(inst.if_id, 1)
     ntools.eq_(inst.isd_as, isd_as.return_value)
     ntools.eq_(inst.link_type, "PARENT")
     ntools.eq_(inst.bandwidth, 1001)
     ntools.eq_(inst.mtu, 4242)
     ntools.eq_(inst.overlay, "UDP/IPv4")
     parse.assert_called_once_with("toaddr")
     ntools.eq_(inst.remote[0], (parse.return_value, 5))
Example #3
0
 def test_full(self, super_init, isd_as, parse):
     intf_dict = {
         'Addr': 'addr',
         'IFID': 1,
         'ISD_AS': '3-2',
         'LinkType': 'PARENT',
         'ToUdpPort': 5,
         'UdpPort': 6,
         'ToAddr': 'toaddr',
         "Bandwidth": 1001,
         'MTU': 4242,
     }
     # Call
     inst = InterfaceElement(intf_dict, 'name')
     # Tests
     super_init.assert_called_once_with(inst, 'addr', 'name')
     ntools.eq_(inst.if_id, 1)
     ntools.eq_(inst.isd_as, isd_as.return_value)
     ntools.eq_(inst.link_type, "PARENT")
     ntools.eq_(inst.to_udp_port, 5)
     ntools.eq_(inst.udp_port, 6)
     ntools.eq_(inst.bandwidth, 1001)
     ntools.eq_(inst.mtu, 4242)
     parse.assert_called_once_with("toaddr")
     ntools.eq_(inst.to_addr, parse.return_value)
Example #4
0
 def test_stripped(self, super_init, isd_as, parse):
     intf_dict = {
         'Bandwidth': 1001,
         'ISD_AS': '3-ff00:0:301',
         'LinkTo': 'PARENT',
         'MTU': 4242
     }
     if_id = 1
     # Call
     inst = InterfaceElement(if_id, intf_dict, 'name')
     # Tests
     super_init.assert_called_once_with(inst, None, 'name')
     ntools.eq_(inst.if_id, 1)
     ntools.eq_(inst.isd_as, isd_as.return_value)
     ntools.eq_(inst.link_type, "parent")
     ntools.eq_(inst.bandwidth, 1001)
     ntools.eq_(inst.mtu, 4242)
     ntools.eq_(inst.overlay, None)
     assert parse.call_count == 0
     ntools.eq_(inst.remote, None)