Example #1
0
 def register_down_segment(self, pcb):
     """
     Send down-segment to Core Path Server
     """
     pcb.sign(self.signing_key)
     core_path = pcb.get_path(reverse_direction=True)
     records = PathRecordsReg.from_values({PST.DOWN: [pcb]})
     dst_ia = pcb.asm(0).isd_as()
     meta = self._build_meta(ia=dst_ia, host=SVCType.PS_A, path=core_path, reuse=True)
     self.send_meta(CtrlPayload(PathMgmt(records)), meta)
     return meta
Example #2
0
 def register_down_segment(self, pcb):
     """
     Send down-segment to Core Path Server
     """
     core_path = pcb.get_path(reverse_direction=True)
     records = PathRecordsReg.from_values({PST.DOWN: [pcb]})
     dst_ia = pcb.asm(0).isd_as()
     meta = self.DefaultMeta.from_values(ia=dst_ia,
                                         host=SVCType.PS_A,
                                         path=core_path)
     self.send_meta(records, meta)
Example #3
0
    def register_up_segment(self, pcb, svc_type):
        """
        Send up-segment to Local Path Servers and Sibra Servers

        :raises:
            SCIONServiceLookupError: service type lookup failure
        """
        records = PathRecordsReg.from_values({PST.UP: [pcb]})
        addr, port = self.dns_query_topo(svc_type)[0]
        meta = self._build_meta(host=addr, port=port)
        self.send_meta(records, meta)
        return meta
Example #4
0
    def register_core_segment(self, pcb, svc_type):
        """
        Send core-segment to Local Path Servers and Sibra Servers

        :raises:
            SCIONServiceLookupError: service type lookup failure
        """
        pcb.sign(self.signing_key)
        # Register core path with local core path server.
        addr, port = self.dns_query_topo(svc_type)[0]
        records = PathRecordsReg.from_values({PST.CORE: [pcb]})
        meta = self._build_meta(host=addr, port=port, reuse=True)
        self.send_meta(CtrlPayload(PathMgmt(records.copy())), meta)
        return meta
Example #5
0
    def register_up_segment(self, pcb):
        """
        Send up-segment to Local Path Servers and Sibra Servers

        :raises:
            SCIONServiceLookupError: path server lookup failure
        """
        records = PathRecordsReg.from_values({PST.UP: [pcb]})
        addr, port = self.dns_query_topo(PATH_SERVICE)[0]
        meta = self.DefaultMeta.from_values(host=addr, port=port)
        self.send_meta(records.copy(), meta)
        addr, port = self.dns_query_topo(SIBRA_SERVICE)[0]
        meta = self.DefaultMeta.from_values(host=addr, port=port)
        self.send_meta(records, meta)
Example #6
0
 def _create_reg_pkt(self, type_, remote=False):
     if remote:
         dst_ia = self.remote
         path = self.seg.get_path(True)
     else:
         dst_ia = self.addr.isd_as
         path = SCIONPath()
     pcb = self._create_reg_pcb(remote)
     pld = PathRecordsReg.from_values({type_: [pcb]})
     dest = SCIONAddr.from_values(dst_ia, SVCType.PS_A)
     cmn_hdr, addr_hdr = build_base_hdrs(self.addr, dest)
     udp_hdr = SCIONUDPHeader.from_values(self.addr, self._port, dest, 0)
     return SCIONL4Packet.from_values(cmn_hdr, addr_hdr, path, [], udp_hdr,
                                      pld)
Example #7
0
    def register_up_segment(self, pcb):
        """
        Send up-segment to Local Path Servers and Sibra Servers

        :raises:
            SCIONServiceLookupError: path server lookup failure
        """
        records = PathRecordsReg.from_values({PST.UP: [pcb]})
        ps_host = self.dns_query_topo(PATH_SERVICE)[0]
        pkt = self._build_packet(ps_host, payload=records.copy())
        self.send(pkt, ps_host)
        sb_host = self.dns_query_topo(SIBRA_SERVICE)[0]
        pkt = self._build_packet(sb_host, payload=records)
        self.send(pkt, sb_host)
Example #8
0
    def register_down_segment(self, pcb):
        """
        Send down-segment to Core Path Server
        """
        core_path = pcb.get_path(reverse_direction=True)
        records = PathRecordsReg.from_values({PST.DOWN: [pcb]})
        dst_ia = pcb.asm(0).isd_as()
        pkt = self._build_packet(SVCType.PS,
                                 dst_ia=dst_ia,
                                 path=core_path,
                                 payload=records)
        fwd_if = core_path.get_fwd_if()
        if fwd_if not in self.ifid2er:
            raise SCIONKeyError("Invalid IF %d in CorePath" % fwd_if)

        next_hop = self.ifid2er[fwd_if].addr
        self.send(pkt, next_hop)
Example #9
0
 def register_core_segment(self, pcb):
     """
     Register the core segment contained in 'pcb' with the local core path
     server.
     """
     pcb.sign(self.signing_key)
     # Register core path with local core path server.
     try:
         addr, port = self.dns_query_topo(PATH_SERVICE)[0]
     except SCIONServiceLookupError:
         # If there are no local path servers, stop here.
         return
     records = PathRecordsReg.from_values({PST.CORE: [pcb]})
     meta = self.DefaultMeta.from_values(host=addr, port=port)
     self.send_meta(records.copy(), meta)
     addr, port = self.dns_query_topo(SIBRA_SERVICE)[0]
     meta = self.DefaultMeta.from_values(host=addr, port=port)
     self.send_meta(records, meta)
Example #10
0
 def register_core_segment(self, pcb):
     """
     Register the core segment contained in 'pcb' with the local core path
     server.
     """
     pcb.remove_crypto()
     pcb.sign(self.signing_key)
     # Register core path with local core path server.
     try:
         ps_addr = self.dns_query_topo(PATH_SERVICE)[0]
     except SCIONServiceLookupError:
         # If there are no local path servers, stop here.
         return
     records = PathRecordsReg.from_values({PST.CORE: [pcb]})
     pkt = self._build_packet(ps_addr, payload=records.copy())
     self.send(pkt, ps_addr)
     sb_host = self.dns_query_topo(SIBRA_SERVICE)[0]
     pkt = self._build_packet(sb_host, payload=records)
     self.send(pkt, sb_host)