示例#1
0
    def run(self, output):
        """ Run experiment

        :param output: scenario output to push results
        :return: None
        """

        self._fill_traffic_profile()

        traffic_runners = [vnf for vnf in self.vnfs if vnf.runs_traffic]

        for traffic_gen in traffic_runners:
            traffic_gen.listen_traffic(self.traffic_profile)

        self.collector = Collector(self.vnfs,
                                   context_base.Context.get_physical_nodes())
        self.collector.start()

        for traffic_gen in traffic_runners:
            LOG.info("Run traffic on %s", traffic_gen.name)
            traffic_gen.run_traffic(self.traffic_profile)

        output.push(self.collector.get_kpi())

        self.collector.stop()
示例#2
0
    def setup(self):
        """ Setup infrastructure, provission VNFs & start traffic

        :return:
        """
        # 1. Verify if infrastructure mapping can meet topology
        self.map_topology_to_infrastructure()
        # 1a. Load VNF models
        self.load_vnf_models()
        # 1b. Fill traffic profile with information from topology
        self._fill_traffic_profile()

        # 2. Provision VNFs

        # link events will cause VNF application to exit
        # so we should start traffic runners before VNFs
        traffic_runners = [vnf for vnf in self.vnfs if vnf.runs_traffic]
        non_traffic_runners = [
            vnf for vnf in self.vnfs if not vnf.runs_traffic
        ]
        try:
            for vnf in chain(traffic_runners, non_traffic_runners):
                LOG.info("Instantiating %s", vnf.name)
                vnf.instantiate(self.scenario_cfg, self.context_cfg)
                LOG.info("Waiting for %s to instantiate", vnf.name)
                vnf.wait_for_instantiate()
        except:
            LOG.exception("")
            for vnf in self.vnfs:
                vnf.terminate()
            raise

        # we have to generate pod.yaml here after VNF has probed so we know vpci and driver
        self._generate_pod_yaml()

        # 3. Run experiment
        # Start listeners first to avoid losing packets
        for traffic_gen in traffic_runners:
            traffic_gen.listen_traffic(self.traffic_profile)

        # register collector with yardstick for KPI collection.
        self.collector = Collector(self.vnfs,
                                   context_base.Context.get_physical_nodes())
        self.collector.start()

        # Start the actual traffic
        for traffic_gen in traffic_runners:
            LOG.info("Starting traffic on %s", traffic_gen.name)
            traffic_gen.run_traffic(self.traffic_profile)
示例#3
0
    def setup(self):
        """ Setup infrastructure, provission VNFs & start traffic

        :return:
        """

        # 1. Verify if infrastructure mapping can meet topology
        self.map_topology_to_infrastructure(self.context_cfg, self.topology)
        # 1a. Load VNF models
        self.vnfs = self.load_vnf_models(self.context_cfg)
        # 1b. Fill traffic profile with information from topology
        self.traffic_profile = self._fill_traffic_profile(
            self.scenario_cfg, self.context_cfg)

        # 2. Provision VNFs
        try:
            for vnf in self.vnfs:
                LOG.info("Instantiating %s", vnf.name)
                vnf.instantiate(self.scenario_cfg, self.context_cfg)
        except RuntimeError:
            for vnf in self.vnfs:
                vnf.terminate()
            raise

        # 3. Run experiment
        # Start listeners first to avoid losing packets
        traffic_runners = [vnf for vnf in self.vnfs if vnf.runs_traffic]
        for traffic_gen in traffic_runners:
            traffic_gen.listen_traffic(self.traffic_profile)

        # register collector with yardstick for KPI collection.
        self.collector = Collector(self.vnfs, self.traffic_profile)
        self.collector.start()

        # Start the actual traffic
        for traffic_gen in traffic_runners:
            LOG.info("Starting traffic on %s", traffic_gen.name)
            traffic_gen.run_traffic(self.traffic_profile)
示例#4
0
    def run(self, output):
        """ Run experiment

        :param output: scenario output to push results
        :return: None
        """

        self._fill_traffic_profile()

        traffic_runners = [vnf for vnf in self.vnfs if vnf.runs_traffic]

        for traffic_gen in traffic_runners:
            traffic_gen.listen_traffic(self.traffic_profile)

        self.collector = Collector(self.vnfs,
                                   context_base.Context.get_physical_nodes())
        self.collector.start()

        test_completed = False
        while not test_completed:
            for traffic_gen in traffic_runners:
                LOG.info("Run traffic on %s", traffic_gen.name)
                traffic_gen.run_traffic_once(self.traffic_profile)

            test_completed = True
            for traffic_gen in traffic_runners:
                # wait for all tg to complete running traffic
                status = traffic_gen.wait_on_traffic()
                LOG.info("Run traffic on %s complete status=%s",
                         traffic_gen.name, status)
                if status == 'CONTINUE':
                    # continue running if at least one tg is running
                    test_completed = False

            output.push(self.collector.get_kpi())

        self.collector.stop()