mock cross_connect test added to test/core/integration.py
[nepi.git] / test / lib / mock / metadata_v01.py
index 67a0eac..d12e9ae 100644 (file)
@@ -13,19 +13,20 @@ APP = "Application"
 
 ### Connection functions ####
 
+def connect_cross(testbed_instance, guid, cross_data):
+    connected = True
+    testbed_instance.set(guid, "cross", True)
+
 ### Creation functions ###
 
 def create_node(testbed_instance, guid):
-    element = NODE 
-    testbed_instance.elements[guid] = element
+    testbed_instance.elements[guid] = NODE
 
 def create_iface(testbed_instance, guid):
-     element = IFACE
-     testbed_instance.elements[guid] = element
+     testbed_instance.elements[guid] = IFACE
 
 def create_application(testbed_instance, guid):
-     element = APP
-     testbed_instance.elements[guid] = element
+     testbed_instance.elements[guid] = APP
 
 ### Start/Stop functions ###
 
@@ -61,28 +62,36 @@ connector_types = dict({
                 "max": 1, 
                 "min": 0
             }),
+    "cross": dict({
+                "help": "Connector to an Interface in other testbed", 
+                "name": "cross",
+                "max": 1, 
+                "min": 0
+            }),
    })
 
 connections = [
     dict({
         "from": (TESTBED_ID, NODE, "devs"),
         "to":   (TESTBED_ID, IFACE, "node"),
-        "code": None,
         "can_cross": False
     }),
     dict({
         "from": (TESTBED_ID, IFACE, "iface"),
         "to":   (TESTBED_ID, IFACE, "iface"),
-        "code": None,
         "can_cross": False
     }),
     dict({
         "from": (TESTBED_ID, NODE, "apps"),
         "to":   (TESTBED_ID, APP, "node"),
-        "code": None,
         "can_cross": False
-    })
-]
+    }),
+    dict({
+        "from": (TESTBED_ID, IFACE, "cross"),
+        "to":   ("mock2", IFACE, "cross"),
+        "init_code": connect_cross,
+        "can_cross": True,
+    })]
 
 attributes = dict({
     "fake": dict({
@@ -90,8 +99,6 @@ attributes = dict({
                 "help": "fake attribute",
                 "type": Attribute.BOOL,
                 "value": False,
-                "range": None,
-                "allowed": None,
                 "validation_function": validation.is_bool
             }),
     "test": dict({
@@ -100,6 +107,13 @@ attributes = dict({
                 "type": Attribute.STRING,
                 "validation_function": validation.is_string
             }),
+    "cross": dict({
+                "name": "cross",
+                "help": "Attribute that indicates if cross connection was performed",
+                "type": Attribute.BOOL,
+                "value": False,
+                "validation_function": validation.is_bool
+        })
     })
 
 traces = dict({
@@ -131,8 +145,8 @@ factories_info = dict({
             "status_function": None,
             "allow_addresses": True,
             "factory_attributes": ["fake"],
-            "box_attributes": ["fake","test"],
-            "connector_types": ["node", "iface"]
+            "box_attributes": ["fake", "test", "cross"],
+            "connector_types": ["node", "iface", "cross"]
        }),
     APP: dict({
             "help": "Fake application",
@@ -141,7 +155,7 @@ factories_info = dict({
             "start_function": None,
             "stop_function": None,
             "status_function": status_application,
-            "box_attributes": ["fake","test"],
+            "box_attributes": ["fake", "test"],
             "connector_types": ["node"],
             "traces": ["fake"]
         }),