Ejemplo n.º 1
0
 def test(self, parse):
     zk_dict = {
         'zk0': {'Addr': 'zkv4', 'L4Port': 2181},
         'zk1': {'Addr': 'zkv6', 'L4Port': 2182},
     }
     inst = Topology()
     parse.side_effect = lambda x: x
     # Call
     inst._parse_zk_dicts({"ZookeeperService": zk_dict})
     # Tests
     ntools.assert_count_equal(inst.zookeepers,
                               ["[zkv4]:2181", "[zkv6]:2182"])
Ejemplo n.º 2
0
 def test(self, isd_as):
     topo_dict = {'Core': True, 'ISD_AS': '1-ff00:0:312', 'MTU': 440, 'Overlay': 'UDP/IPv4'}
     inst = Topology()
     inst._parse_srv_dicts = create_mock()
     inst._parse_router_dicts = create_mock()
     inst._parse_zk_dicts = create_mock()
     # Call
     inst.parse_dict(topo_dict)
     # Tests
     ntools.eq_(inst.is_core_as, True)
     ntools.eq_(inst.isd_as, isd_as.return_value)
     ntools.eq_(inst.mtu, 440)
     inst._parse_srv_dicts.assert_called_once_with(topo_dict)
     inst._parse_router_dicts.assert_called_once_with(topo_dict)
     inst._parse_zk_dicts.assert_called_once_with(topo_dict)
Ejemplo n.º 3
0
 def test(self, isd_as):
     topo_dict = {'Core': True, 'ISD_AS': '1-2', 'DnsDomain': 3, 'MTU': 440}
     inst = Topology()
     inst._parse_srv_dicts = create_mock()
     inst._parse_router_dicts = create_mock()
     inst._parse_zk_dicts = create_mock()
     # Call
     inst.parse_dict(topo_dict)
     # Tests
     ntools.eq_(inst.is_core_as, True)
     ntools.eq_(inst.isd_as, isd_as.return_value)
     ntools.eq_(inst.dns_domain, 3)
     ntools.eq_(inst.mtu, 440)
     inst._parse_srv_dicts.assert_called_once_with(topo_dict)
     inst._parse_router_dicts.assert_called_once_with(topo_dict)
     inst._parse_zk_dicts.assert_called_once_with(topo_dict)