Exemplo n.º 1
0
    def datapath_connect(self, discovered_up_port_nums):
        """Handle Ryu datapath connection event and provision pipeline.

        Args:
            discovered_up_port_nums (list): datapath ports that are up as ints.
        Returns:
            list: OpenFlow messages to send to datapath.
        """
        self.logger.info('Cold start configuring DP')
        self._notify({'DP_CHANGE': {'reason': 'cold_start'}})
        ofmsgs = []
        ofmsgs.append(valve_of.faucet_config())
        ofmsgs.append(
            valve_of.faucet_async(
                notify_flow_removed=self.dp.use_idle_timeout))
        ofmsgs.extend(self._add_default_flows())
        ofmsgs.extend(self._add_ports_and_vlans(discovered_up_port_nums))
        ofmsgs.extend(self._add_controller_learn_flow())
        self.dp.dyn_last_coldstart_time = time.time()
        self.dp.running = True
        self.metrics.of_dp_connections.labels(  # pylint: disable=no-member
            **self.base_prom_labels).inc()
        self.metrics.dp_status.labels(  # pylint: disable=no-member
            **self.base_prom_labels).set(1)
        return ofmsgs
Exemplo n.º 2
0
    def _handler_datapath_up(self, ryu_dp):
        """Handle DP up.

        Args:
            ryu_dp (ryu.controller.controller.Datapath): datapath.
        """
        dp_id = ryu_dp.id
        if dp_id in self.watchers:
            self.logger.info('%s up', dpid_log(dp_id))
            for watchers in list(self.watchers[dp_id].values()):
                is_active = True
                for watcher in watchers:
                    watcher.report_dp_status(1)
                    watcher.start(ryu_dp, is_active)
                    if is_active:
                        self.logger.info(
                            '%s %s watcher starting',
                            dpid_log(dp_id),
                            watcher.conf.type
                            )
                        is_active = False
            ryu_dp.send_msg(valve_of.faucet_config(datapath=ryu_dp))
            ryu_dp.send_msg(valve_of.gauge_async(datapath=ryu_dp))
        else:
            self.logger.info('%s up, unknown', dpid_log(dp_id))
Exemplo n.º 3
0
    def _datapath_connect(self, ryu_event):
        """Handle DP up.

        Args:
            ryu_event (ryu.controller.event.EventReplyBase): DP event.
        """
        watchers, ryu_dp, _ = self._get_watchers(ryu_event)
        if watchers is None:
            return
        self.logger.info('%s up', dpid_log(ryu_dp.id))
        ryu_dp.send_msg(valve_of.faucet_config(datapath=ryu_dp))
        ryu_dp.send_msg(valve_of.faucet_async(datapath=ryu_dp, packet_in=False))
        self._start_watchers(ryu_dp, watchers, time.time())
Exemplo n.º 4
0
    def _handler_datapath_up(self, ryu_dp):
        """Handle DP up.

        Args:
            ryu_dp (ryu.controller.controller.Datapath): datapath.
        """
        watchers = self._get_watchers(ryu_dp, '_handler_datapath_up')
        if watchers is None:
            return
        self.logger.info('%s up', dpid_log(ryu_dp.id))
        ryu_dp.send_msg(valve_of.faucet_config(datapath=ryu_dp))
        ryu_dp.send_msg(valve_of.gauge_async(datapath=ryu_dp))
        self._start_watchers(ryu_dp, ryu_dp.id, watchers)
Exemplo n.º 5
0
    def _datapath_connect(self, ryu_event):
        """Handle DP up.

        Args:
            ryu_event (ryu.controller.event.EventReplyBase): DP event.
        """
        watchers, ryu_dp, _ = self._get_watchers(ryu_event)
        if watchers is None:
            return
        self.logger.info('%s up', dpid_log(ryu_dp.id))
        ryu_dp.send_msg(valve_of.faucet_config(datapath=ryu_dp))
        ryu_dp.send_msg(valve_of.faucet_async(datapath=ryu_dp, packet_in=False))
        self._start_watchers(ryu_dp, watchers, time.time())
Exemplo n.º 6
0
    def datapath_connect(self, discovered_up_port_nums):
        """Handle Ryu datapath connection event and provision pipeline.

        Args:
            discovered_up_port_nums (list): datapath ports that are up as ints.
        Returns:
            list: OpenFlow messages to send to datapath.
        """
        self.logger.info('Cold start configuring DP')
        self._notify({'DP_CHANGE': {'reason': 'cold_start'}})
        ofmsgs = []
        ofmsgs.append(valve_of.faucet_config())
        ofmsgs.append(valve_of.faucet_async())
        ofmsgs.extend(self._add_default_flows())
        ofmsgs.extend(self._add_ports_and_vlans(discovered_up_port_nums))
        ofmsgs.extend(self._add_controller_learn_flow())
        self.dp.running = True
        return ofmsgs