[CORD-1943] Adding service graph constraints to rcord

Change-Id: I815574342ffe87a5d623723bd29c84d11b4d9b49
(cherry picked from commit 686f70224ac0b562f3c977a22693aa8c29985376)
diff --git a/profile_manifests/rcord.yml b/profile_manifests/rcord.yml
index b5cdbb3..3b50d5d 100644
--- a/profile_manifests/rcord.yml
+++ b/profile_manifests/rcord.yml
@@ -38,6 +38,9 @@
   - vrouter.yaml
   - xos-gui-extensions.yml
 
+xos_new_tosca_config_templates:
+  - service-graph-constraints.yaml
+
 xos_other_templates:
   - fabric-network-cfg.json
 
@@ -83,6 +86,9 @@
 #    keypair: monitoringservice_rsa
 #    synchronizer: false
 
+# service graph gui constraints
+xos_gui_service_graph_constranints: '[[null, "rcord"], [null, "volt"], ["addressmanager", "vsg"], [null, "vrouter"]]'
+
 profile_library: "rcord"
 
 # VTN network configuration
diff --git a/roles/cord-profile/defaults/main.yml b/roles/cord-profile/defaults/main.yml
index a217af0..0b7626e 100644
--- a/roles/cord-profile/defaults/main.yml
+++ b/roles/cord-profile/defaults/main.yml
@@ -62,6 +62,8 @@
 
 xos_services: []
 
+xos_gui_service_graph_constranints: []
+
 xos_tosca_config_templates: []
 
 xos_new_tosca_config_templates: []
diff --git a/roles/cord-profile/templates/cord-services.yaml.j2 b/roles/cord-profile/templates/cord-services.yaml.j2
index ce8311f..c3138fe 100644
--- a/roles/cord-profile/templates/cord-services.yaml.j2
+++ b/roles/cord-profile/templates/cord-services.yaml.j2
@@ -54,6 +54,10 @@
 
     service#rcord:
       type: tosca.nodes.Service
+      requirements:
+        - rcord_tenant:
+            node: service#volt
+            relationship: tosca.relationships.TenantOfService
 
 # ONOS_CORD, fully created in vtn.yaml
     service#ONOS_CORD:
diff --git a/roles/cord-profile/templates/service-graph-constraints.yaml.j2 b/roles/cord-profile/templates/service-graph-constraints.yaml.j2
new file mode 100644
index 0000000..f1897b1
--- /dev/null
+++ b/roles/cord-profile/templates/service-graph-constraints.yaml.j2
@@ -0,0 +1,14 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/servicegraphconstraint.yaml
+
+description: Constraints on the Services position in the graph
+
+topology_template:
+  node_templates:
+
+    constraints:
+      type: tosca.nodes.ServiceGraphConstraint
+      properties:
+        constraints: '{{xos_gui_service_graph_constranints}}'
\ No newline at end of file