Beispiel #1
0
 def _parse_block(self, data, num_hops, steady=True):
     """Parse a reservation block."""
     block_len = (1 + num_hops) * self.LINE_LEN
     block = data.pop(block_len)
     if steady:
         return ResvBlockSteady(block)
     return ResvBlockEphemeral(block)
Beispiel #2
0
 def setup_from_values(cls, req_info, total_hops, path_id,
                       setup=True):  # pragma: no cover
     """Construct a setup request header."""
     inst = cls()
     inst.setup = setup
     inst.total_hops = total_hops
     inst.path_ids = [path_id]
     inst.req_block = ResvBlockSteady.from_values(req_info, inst.total_hops)
     inst._parse_src_ia()
     inst._set_size()
     return inst
Beispiel #3
0
 def _sibra_strip_pcb(self, pcb):
     assert pcb.is_sibra()
     pcb_ext = pcb.sibra_ext
     resv_info = pcb_ext.info
     resv = ResvBlockSteady.from_values(resv_info, pcb.get_n_hops())
     asms = pcb.iter_asms()
     if pcb_ext.p.up:
         asms = reversed(list(asms))
     iflist = []
     for sof, asm in zip(pcb_ext.iter_sofs(), asms):
         resv.sofs.append(sof)
         iflist.extend(self._sibra_add_ifs(
             asm.isd_as(), sof, resv_info.fwd_dir))
     assert resv.num_hops == len(resv.sofs)
     return pcb_ext.p.id, resv, iflist
Beispiel #4
0
 def teardown(self):  # pragma: no cover
     """Shut down the current reservation."""
     # FIXME(kormat): not implemented yet in sibra state.
     req_info = ResvInfoSteady.from_values(0, BWSnapshot(), 0)
     self.req_block = ResvBlockSteady.from_values(req_info, self.total_hops)
     self._set_size()