def test_get_subedge_info_by_key_matching(self): """ check that you can get a subedge routing info from a routing info based off key :return: """ subv1 = PartitionedVertex(None, "") subv2 = PartitionedVertex(None, "") sube = MultiCastPartitionedEdge(subv1, subv2) keys_and_masks = list() keys_and_masks.append(BaseKeyAndMask(0x0012, 0x00ff)) sri = SubedgeRoutingInfo(keys_and_masks, sube) ri = RoutingInfo([sri]) self.assertIn(sri, ri.get_subedge_infos_by_key(0xff12, 0x00ff))
def test_get_subedge_info_by_key_not_matching(self): """ check that trying to locate a subedge info with an invalid key and mask results in no subedge info being returned :return: """ subv1 = PartitionedVertex(None, "") subv2 = PartitionedVertex(None, "") sube = MultiCastPartitionedEdge(subv1, subv2) keys_and_masks = list() keys_and_masks.append(BaseKeyAndMask(0x0012, 0x00ff)) sri = SubedgeRoutingInfo(keys_and_masks, sube) ri = RoutingInfo([sri]) self.assertEqual(ri.get_subedge_infos_by_key(0xff12, 0x000f), None)