MPLS support + loop_vm_arp test fix
[nfvbench.git] / nfvbench / specs.py
index 7a24d5c..ec5e24e 100644 (file)
 class Encaps(object):
     VLAN = "VLAN"
     VxLAN = "VxLAN"
-    BASIC = "BASIC"
+    MPLS = "MPLS"
+    NO_ENCAPS = "NONE"
 
     encaps_mapping = {
         'VLAN': VLAN,
-        'VXLAN': VxLAN
+        'VXLAN': VxLAN,
+        'MPLS': MPLS,
+        'NONE': NO_ENCAPS
     }
 
     @classmethod
@@ -33,22 +36,13 @@ class ChainType(object):
     PVP = "PVP"
     PVVP = "PVVP"
     EXT = "EXT"
-
-    chain_mapping = {
-        'PVP': PVP,
-        'PVVP': PVVP,
-        'EXT': EXT
-    }
-
-    @classmethod
-    def get_chain_type(cls, chain):
-        return cls.chain_mapping.get(chain.upper(), None)
+    names = [EXT, PVP, PVVP]
 
 
 class OpenStackSpec(object):
     def __init__(self):
         self.__vswitch = "BASIC"
-        self.__encaps = Encaps.BASIC
+        self.__encaps = Encaps.NO_ENCAPS
 
     @property
     def vswitch(self):
@@ -75,7 +69,8 @@ class OpenStackSpec(object):
 
 class RunSpec(object):
     def __init__(self, no_vswitch_access, openstack_spec):
-        self.use_vswitch = (not no_vswitch_access) and openstack_spec.vswitch != "BASIC"
+        self.use_vswitch = (not no_vswitch_access) and openstack_spec \
+            and openstack_spec.vswitch != "BASIC"
 
 
 class Specs(object):