def test(self, build_path):
     up_segments = ['up0', 'up1']
     down_segments = ['down0', 'down1']
     build_path.side_effect = [['path0'], ['path1'], [], ['path1']]
     peer_revs = create_mock()
     ntools.eq_(
         path_combinator.build_shortcut_paths(
             up_segments, down_segments, peer_revs),
         ["path0", "path1"])
     calls = [call(*x, peer_revs)
              for x in product(up_segments, down_segments)]
     assert_these_calls(build_path, calls)
Exemple #2
0
 def _resolve_not_core_not_core_scion(self, dst_ia):
     """Resolve SCION path from non-core to non-core."""
     up_segs = self.up_segments()
     down_segs = self.down_segments(last_ia=dst_ia)
     core_segs = self._calc_core_segs(dst_ia[0], up_segs, down_segs)
     full_paths = build_shortcut_paths(up_segs, down_segs, self.peer_revs)
     tuples = []
     for up_seg in up_segs:
         for down_seg in down_segs:
             tuples.append((up_seg, None, down_seg))
             for core_seg in core_segs:
                 tuples.append((up_seg, core_seg, down_seg))
     full_paths.extend(tuples_to_full_paths(tuples))
     return full_paths