Merge "multi-queue: Add basic multi-queue functionality"
[vswitchperf.git] / core / vnf_controller.py
index 3313e9e..8800cca 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2016 Intel Corporation.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
 """
 
 import logging
+import pexpect
 from vnfs.vnf.vnf import IVnf
 
 class VnfController(object):
@@ -43,10 +44,14 @@ class VnfController(object):
         self._deployment_scenario = deployment_scenario.upper()
         if self._deployment_scenario == 'P2P':
             self._vnfs = []
-        if self._deployment_scenario == 'PVP':
+        elif self._deployment_scenario == 'PVP':
             self._vnfs = [vnf_class()]
         elif self._deployment_scenario == 'PVVP':
             self._vnfs = [vnf_class(), vnf_class()]
+        elif self._deployment_scenario == 'OP2P':
+            self._vnfs = []
+        else:
+            self._vnfs = []
         self._logger.debug('__init__ ' + str(len(self._vnfs)) +
                            ' VNF[s] with ' + ' '.join(map(str, self._vnfs)))
 
@@ -64,8 +69,12 @@ class VnfController(object):
         """
         self._logger.debug('start ' + str(len(self._vnfs)) +
                            ' VNF[s] with ' + ' '.join(map(str, self._vnfs)))
-        for vnf in self._vnfs:
-            vnf.start()
+        try:
+            for vnf in self._vnfs:
+                vnf.start()
+        except pexpect.TIMEOUT:
+            self.stop()
+            raise
 
     def stop(self):
         """Stops all VNFs set-up by __init__.