Exemplo n.º 1
0
    def _monitor_and_update(self):
        while self._gw_mac_monitor_on:
            gw_info_list = get_mobilityd_gw_info()
            for gw_info in gw_info_list:
                if gw_info and gw_info.ip:
                    latest_mac_addr = self._get_gw_mac_address(
                        gw_info.ip, gw_info.vlan)
                    if latest_mac_addr is None or latest_mac_addr == "":
                        latest_mac_addr = gw_info.mac
                    self.logger.debug("mac [%s] for vlan %s", latest_mac_addr,
                                      gw_info.vlan)
                    msgs = self._get_default_egress_flow_msgs(
                        self._datapath,
                        latest_mac_addr,
                        gw_info.vlan,
                        ipv6=(gw_info.ip.version == IPAddress.IPV6),
                    )

                    chan = self._msg_hub.send(msgs, self._datapath)
                    self._wait_for_responses(chan, len(msgs))

                    if latest_mac_addr and latest_mac_addr != "":
                        set_mobilityd_gw_info(
                            gw_info.ip,
                            latest_mac_addr,
                            gw_info.vlan,
                        )
                else:
                    self.logger.warning("No default GW found.")

            hub.sleep(self.config.non_nat_gw_probe_frequency)
Exemplo n.º 2
0
    def _monitor_and_update(self):
        while True:
            gw_info_list = get_mobilityd_gw_info()
            for gw_info in gw_info_list:
                if gw_info and gw_info.ip:
                    latest_mac_addr = self._get_gw_mac_address(gw_info.ip, gw_info.vlan)
                    self.logger.debug("mac [%s] for vlan %s", latest_mac_addr, gw_info.vlan)
                    if latest_mac_addr == "":
                        latest_mac_addr = gw_info.mac

                    self._install_default_egress_flows(self._datapath,
                                                       latest_mac_addr,
                                                       gw_info.vlan)
                    if latest_mac_addr != "":
                        set_mobilityd_gw_info(gw_info.ip,
                                              latest_mac_addr,
                                              gw_info.vlan)
                else:
                    self.logger.warning("No default GW found.")

            hub.sleep(self.config.non_nat_gw_probe_frequency)
Exemplo n.º 3
0
    def _monitor_and_update(self):
        while True:
            updated_info = get_mobilityd_gw_info()
            if updated_info:
                cached_gw_info = updated_info
            if cached_gw_info and cached_gw_info.ip:
                latest_mac_addr = self._get_gw_mac_address(cached_gw_info.ip)
                if len(latest_mac_addr) == 17 and \
                        self._current_upstream_mac != latest_mac_addr:
                    self._install_default_egress_flows(self._datapath,
                                                       latest_mac_addr)
                    cached_gw_info.mac = latest_mac_addr
                    set_gw_info = cached_gw_info
                    set_mobilityd_gw_info(set_gw_info)
                elif latest_mac_addr != "":
                    self.logger.warning("invalid mac: %s", latest_mac_addr)
            else:
                self.logger.warning("No default GW found.")

            self.logger.info("non_mat_gw_probe_frequency: %s mac: [%s]",
                             self.config.non_mat_gw_probe_frequency,
                             self._current_upstream_mac)
            hub.sleep(self.config.non_mat_gw_probe_frequency)