Example #1
0
 def handle_restart(self,
                    ue_requests: SetupUEMacRequest) -> SetupFlowsResult:
     """
     Setup the arp flows for the controller, this is used when the controller
     restarts. Only setup those UEs that are passed from sessiond.
     """
     self.delete_all_flows(self._datapath)
     self._install_default_flows(self._datapath)
     records = get_all_records()
     attached_ues = [ue.sid.id for ue in ue_requests]
     self.logger.debug("Setting up ARP controller with list of UEs:")
     self.logger.debug(*attached_ues)
     for rec in records:
         if rec.id not in attached_ues:
             self.logger.debug("%s is in directoryd, but not an active UE",
                               rec.id)
             continue
         if rec.fields['ipv4_addr'] and rec.fields['mac_addr']:
             self.logger.debug("Restoring arp for IMSI %s, ip %s mac %s",
                               rec.id, rec.fields['ipv4_addr'],
                               rec.fields['mac_addr'])
             self.add_ue_arp_flows(self._datapath, rec.fields['ipv4_addr'],
                                   rec.fields['mac_addr'])
         else:
             self.logger.debug("Subscriber %s didn't get ip from dhcp",
                               rec.id)
Example #2
0
File: arp.py Project: saaib/magma
    def handle_restart(self, req: SetupUEMacRequest) -> SetupFlowsResult:
        """
        Setup the arp flows for the controller, this is used when the controller
        restarts.
        """
        self.delete_all_flows(self._datapath)
        self._install_default_flows(self._datapath)
        records = get_all_records()
        for rec in records:
            self.logger.debug("Restoring arp for imsi %s, ip %s mac %s",
                              rec.id, rec.fields['ipv4_addr'],
                              rec.fields['mac_addr'])

            self.arp_contoller.add_ue_arp_flows(self._datapath,
                                                rec.fields['ipv4_addr'],
                                                rec.fields['mac_addr'])
Example #3
0
    def handle_restart(self,
                       ue_requests: SetupUEMacRequest) -> SetupFlowsResult:
        """
        Setup the arp flows for the controller, this is used when the controller
        restarts. Only setup those UEs that are passed from sessiond.
        """
        self.delete_all_flows(self._datapath)
        self._install_default_flows(self._datapath)
        records = get_all_records()
        attached_ues = [ue.sid.id for ue in ue_requests]
        for rec in records:
            if rec not in attached_ues:
                self.logger.warning(
                    "IMSI %s is in directoryd, but not and active UE", rec.id)
                continue
            self.logger.debug("Restoring arp for IMSI %s, ip %s mac %s",
                              rec.id, rec.fields['ipv4_addr'],
                              rec.fields['mac_addr'])

            self.arp_contoller.add_ue_arp_flows(self._datapath,
                                                rec.fields['ipv4_addr'],
                                                rec.fields['mac_addr'])