COMAC-237,COMAC-255 Refactor mcord profile

- Rename mcord to mcord-services
- Use the onos chart instead of onos-progran chart for bring up progran on onos
  No need to manually restart progran app after deploying anymore
- Make onos rest URL configurable for xos-services/progran service
- Enable and disable fabric conditionally
- Change service dependency

Change-Id: Icc20305349b78bd5b16e6e80ff1621ced733f69d
diff --git a/xos-profiles/comac/Chart.yaml b/xos-profiles/comac/Chart.yaml
index ccbab52..1e996b4 100644
--- a/xos-profiles/comac/Chart.yaml
+++ b/xos-profiles/comac/Chart.yaml
@@ -17,7 +17,7 @@
 name: comac
 description: A Helm chart for the "COMAC" profile
 icon: https://guide.opencord.org/logos/cord.svg
-version: 0.0.8
+version: 0.0.9
 
 # xosproject/tosca-loader version
 appVersion: 1.3.1
diff --git a/xos-profiles/comac/requirements.yaml b/xos-profiles/comac/requirements.yaml
index ee1c608..abac4c8 100644
--- a/xos-profiles/comac/requirements.yaml
+++ b/xos-profiles/comac/requirements.yaml
@@ -50,6 +50,6 @@
   repository: file://../../xos-services/vrouter
   condition: vrouter.enabled
 - name: progran
-  version: 2.0.7
+  version: 2.0.8
   repository: file://../../xos-services/progran
-  condition: progran.enabled
\ No newline at end of file
+  condition: progran.enabled
diff --git a/xos-profiles/mcord/.helmignore b/xos-profiles/mcord-services/.helmignore
similarity index 100%
rename from xos-profiles/mcord/.helmignore
rename to xos-profiles/mcord-services/.helmignore
diff --git a/xos-profiles/mcord/Chart.yaml b/xos-profiles/mcord-services/Chart.yaml
similarity index 85%
rename from xos-profiles/mcord/Chart.yaml
rename to xos-profiles/mcord-services/Chart.yaml
index 9ec12ec..104ad3e 100644
--- a/xos-profiles/mcord/Chart.yaml
+++ b/xos-profiles/mcord-services/Chart.yaml
@@ -13,11 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: mcord
-description: A Helm chart for the "mcord" profile
+apiVersion: v1
+name: mcord-services
+description: A Helm chart for the "mcord-services" profile
 icon: https://guide.opencord.org/logos/cord.svg
-
 version: 1.1.8
 
 # xosproject/tosca-loader version
-appVersion: 1.3.0
+appVersion: 1.3.1
diff --git a/xos-profiles/mcord/requirements.yaml b/xos-profiles/mcord-services/requirements.yaml
similarity index 95%
rename from xos-profiles/mcord/requirements.yaml
rename to xos-profiles/mcord-services/requirements.yaml
index 9b95736..7738014 100644
--- a/xos-profiles/mcord/requirements.yaml
+++ b/xos-profiles/mcord-services/requirements.yaml
@@ -14,21 +14,21 @@
 # limitations under the License.
 
 dependencies:
+- name: mcord-subscriber
+  version: 2.0.5
+  repository: file://../../xos-services/mcord-subscriber
 - name: onos-service
   version: 2.1.3
   repository: file://../../xos-services/onos-service
-  condition: onos-service.enabled
 - name: fabric
   version: 2.2.2
   repository: file://../../xos-services/fabric
   condition: fabric.enabled
-- name: mcord-subscriber
-  version: 2.0.5
-  repository: file://../../xos-services/mcord-subscriber
-- name: progran
-  version: 2.0.7
-  repository: file://../../xos-services/progran
-  condition: progran.enabled
 - name: vrouter
   version: 2.1.0
   repository: file://../../xos-services/vrouter
+  condition: fabric.enabled
+- name: progran
+  version: 2.0.8
+  repository: file://../../xos-services/progran
+  condition: progran.enabled
diff --git a/xos-profiles/mcord/templates/_helpers.tpl b/xos-profiles/mcord-services/templates/_helpers.tpl
similarity index 100%
rename from xos-profiles/mcord/templates/_helpers.tpl
rename to xos-profiles/mcord-services/templates/_helpers.tpl
diff --git a/xos-profiles/mcord/templates/_tosca.tpl b/xos-profiles/mcord-services/templates/_tosca.tpl
similarity index 75%
rename from xos-profiles/mcord/templates/_tosca.tpl
rename to xos-profiles/mcord-services/templates/_tosca.tpl
index 51b5f28..353a6cc 100644
--- a/xos-profiles/mcord/templates/_tosca.tpl
+++ b/xos-profiles/mcord-services/templates/_tosca.tpl
@@ -14,36 +14,15 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 */}}
-{{- define "mcord.fixtureTosca" -}}
+{{- define "mcord-services.onosFabricTosca" -}}
 tosca_definitions_version: tosca_simple_yaml_1_0
-
-imports:
-  - custom_types/site.yaml
-
-description: set up site and deployment and link them
-
-topology_template:
-  node_templates:
-
-    {{ .Values.cordSiteName }}:
-      type: tosca.nodes.Site
-      properties:
-          name: {{ .Values.cordSiteName }}
-          site_url: http://mysite.opencord.us/
-          hosts_nodes: true
-
-{{- end -}}
-
-{{- define "mcord.onosTosca" -}}
-tosca_definitions_version: tosca_simple_yaml_1_0
+description: Configures ONOS services
 
 imports:
    - custom_types/onosapp.yaml
    - custom_types/onosservice.yaml
    - custom_types/serviceinstanceattribute.yaml
 
-description: Configures the VOLTHA ONOS service
-
 topology_template:
   node_templates:
 
@@ -52,7 +31,7 @@
       properties:
           name: onos
           kind: data
-          rest_hostname: {{ .onosRestService | quote }}
+          rest_hostname: {{ .onosFabricRestService | quote }}
           rest_port: 8181
 
     onos_app#segmentrouting:
@@ -86,56 +65,66 @@
             relationship: tosca.relationships.BelongsToOne
 {{- end -}}
 
-{{- define "mcord.serviceGraphTosca" -}}
+{{- define "mcord-services.onosProgranTosca" -}}
+tosca_definitions_version: tosca_simple_yaml_1_0
+description: Configures ONOS services
+
+imports:
+   - custom_types/onosapp.yaml
+   - custom_types/onosservice.yaml
+   - custom_types/serviceinstanceattribute.yaml
+
+topology_template:
+  node_templates:
+
+    service#onos-progran:
+      type: tosca.nodes.ONOSService
+      properties:
+          name: onos-progran
+          kind: data
+          rest_hostname: {{ .onosProgranRestService | quote }}
+          rest_port: 8181
+
+    onos_app#progran:
+      type: tosca.nodes.ONOSApp
+      properties:
+        name: org.onosproject.progran
+        app_id: org.onosproject.progran
+      requirements:
+        - owner:
+            node: service#onos-progran
+            relationship: tosca.relationships.BelongsToOne
+{{- end -}}
+
+{{- define "mcord-services.serviceGraphTosca" -}}
 tosca_definitions_version: tosca_simple_yaml_1_0
 
 imports:
-   - custom_types/fabricservice.yaml
    - custom_types/mcordsubscriberservice.yaml
-   - custom_types/onosservice.yaml
-{{- if .Values.progran.enabled }}
-   - custom_types/progranservice.yaml
-{{- end }}
-   - custom_types/vrouterservice.yaml
    - custom_types/servicegraphconstraint.yaml
    - custom_types/servicedependency.yaml
    - custom_types/service.yaml
+{{- if or .Values.fabric.enabled .Values.progran.enabled }}
+   - custom_types/onosservice.yaml
+{{- end }}
+{{- if .Values.fabric.enabled }}
+   - custom_types/fabricservice.yaml
+   - custom_types/vrouterservice.yaml
+{{- end }}
+{{- if .Values.progran.enabled }}
+   - custom_types/progranservice.yaml
+{{- end }}
 
 description: Configures the M-CORD service graph
 
 topology_template:
   node_templates:
-{{ if .Values.progran.enabled }}
-    service#progran:
-      type: tosca.nodes.ProgranService
-      properties:
-        name: progran
-        must-exist: true
-{{ end }}
-    service#vrouter:
-      type: tosca.nodes.VRouterService
-      properties:
-        name: vrouter
-        must-exist: true
-
     service#mcord:
       type: tosca.nodes.MCordSubscriberService
       properties:
         name: mcord
         must-exist: true
 
-    service#onos:
-      type: tosca.nodes.ONOSService
-      properties:
-        name: onos
-        must-exist: true
-
-    service#fabric:
-      type: tosca.nodes.FabricService
-      properties:
-        name: fabric
-        must-exist: true
-
     service#omec-cp:
       type: tosca.nodes.Service
       properties:
@@ -156,68 +145,40 @@
       properties:
         name: cdn-remote
 
-    service_dependency#onos-fabric_fabric:
-      type: tosca.nodes.ServiceDependency
+{{- if .Values.fabric.enabled }}
+    service#onos:
+      type: tosca.nodes.ONOSService
       properties:
-        connect_method: none
-      requirements:
-        - subscriber_service:
-            node: service#fabric
-            relationship: tosca.relationships.BelongsToOne
-        - provider_service:
-            node: service#onos
-            relationship: tosca.relationships.BelongsToOne
+        name: onos
+        must-exist: true
 
-    service_dependency#vrouter_fabric:
-      type: tosca.nodes.ServiceDependency
+    service#fabric:
+      type: tosca.nodes.FabricService
       properties:
-        connect_method: none
-      requirements:
-        - subscriber_service:
-            node: service#vrouter
-            relationship: tosca.relationships.BelongsToOne
-        - provider_service:
-            node: service#fabric
-            relationship: tosca.relationships.BelongsToOne
+        name: fabric
+        must-exist: true
 
-{{ if .Values.progran.enabled }}
-    service_dependency#mcord_progran:
-      type: tosca.nodes.ServiceDependency
+    service#vrouter:
+      type: tosca.nodes.VRouterService
       properties:
-        connect_method: none
-      requirements:
-        - subscriber_service:
-            node: service#progran
-            relationship: tosca.relationships.BelongsToOne
-        - provider_service:
-            node: service#mcord
-            relationship: tosca.relationships.BelongsToOne
+        name: vrouter
+        must-exist: true
+{{- end }}
 
-    service_dependency#progran_epc_cp:
-      type: tosca.nodes.ServiceDependency
+{{- if .Values.progran.enabled }}
+    service#onos-progran:
+      type: tosca.nodes.ONOSService
       properties:
-        connect_method: none
-      requirements:
-        - subscriber_service:
-            node: service#omec-cp
-            relationship: tosca.relationships.BelongsToOne
-        - provider_service:
-            node: service#progran
-            relationship: tosca.relationships.BelongsToOne
+        name: onos-progran
+        must-exist: true
 
-    service_dependency#progran_epc_up:
-      type: tosca.nodes.ServiceDependency
+    service#progran:
+      type: tosca.nodes.ProgranService
       properties:
-        connect_method: none
-      requirements:
-        - subscriber_service:
-            node: service#omec-up
-            relationship: tosca.relationships.BelongsToOne
-        - provider_service:
-            node: service#progran
-            relationship: tosca.relationships.BelongsToOne
+        name: progran
+        must-exist: true
+{{- end }}
 
-{{ else }}
     service_dependency#mcord_epc_cp:
       type: tosca.nodes.ServiceDependency
       properties:
@@ -241,7 +202,6 @@
         - provider_service:
             node: service#mcord
             relationship: tosca.relationships.BelongsToOne
-{{ end }}
 
     service_dependency#epc_cp_epc_up:
       type: tosca.nodes.ServiceDependency
@@ -255,7 +215,7 @@
             node: service#omec-cp
             relationship: tosca.relationships.BelongsToOne
 
-    service_dependency#epc_up_cdn_local:
+    service_dependency#cdn_remote_cdn_local:
       type: tosca.nodes.ServiceDependency
       properties:
         connect_method: none
@@ -264,29 +224,71 @@
             node: service#cdn-local
             relationship: tosca.relationships.BelongsToOne
         - provider_service:
-            node: service#omec-up
-            relationship: tosca.relationships.BelongsToOne
-
-    service_dependency#cdn_local_cdn_remote:
-      type: tosca.nodes.ServiceDependency
-      properties:
-        connect_method: none
-      requirements:
-        - subscriber_service:
             node: service#cdn-remote
             relationship: tosca.relationships.BelongsToOne
-        - provider_service:
-            node: service#cdn-local
+
+{{- if .Values.fabric.enabled }}
+    service_dependency#fabric_vrouter:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: none
+      requirements:
+        - subscriber_service:
+            node: service#fabric
             relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#onos
+            relationship: tosca.relationships.BelongsToOne
+
+    service_dependency#onos_fabric:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: none
+      requirements:
+        - subscriber_service:
+            node: service#vrouter
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#fabric
+            relationship: tosca.relationships.BelongsToOne
+{{- end }}
+
+{{- if .Values.progran.enabled }}
+    service_dependency#mcord_progran:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: none
+      requirements:
+        - subscriber_service:
+            node: service#progran
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#mcord
+            relationship: tosca.relationships.BelongsToOne
+
+    service_dependency#onos_progran:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: none
+      requirements:
+        - subscriber_service:
+            node: service#progran
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#onos-progran
+            relationship: tosca.relationships.BelongsToOne
+{{- end }}
 
     constraints:
       type: tosca.nodes.ServiceGraphConstraint
       properties:
-{{ if (.Values.seba.enabled) and (.Values.progran.enabled) }}
-        constraints: '[ ["mcord", null, "onos"], ["progran", null, "fabric"], ["omec-cp", null, null] ["omec-up", null, null] ]'
-{{ else if (not .Values.seba.enabled) and (.Values.progran.enabled) }}
-        constraints: '[ ["mcord", "progran", null], ["omec-cp", "omec-up", "onos"], [null, "cdn-local", "fabric"], [null, "cdn-remote", "vrouter"] ]'
-{{ else if (not .Values.seba.enabled) and (not .Values.progran.enabled) }}
-        constraints: '[ [null, "mcord", null], ["omec-cp", "omec-up", "onos"], [null, "cdn-local", "fabric"], [null, "cdn-remote", "vrouter"] ]'
-{{ end }}
-{{- end -}}
\ No newline at end of file
+{{- if and .Values.fabric.enabled .Values.progran.enabled }}
+        constraints: '[ [null, "mcord", null, "fabric"], ["cdn-remote", "omec-cp", "progran", "vrouter"], ["cdn-local", "omec-up", "onos-progran", "onos"] ]'
+{{- else if and (not .Values.fabric.enabled) .Values.progran.enabled }}
+        constraints: '[ [null, null, "mcord", null], ["cdn-remote", "omec-cp", null, "progran"], ["cdn-local", "omec-up", null, "onos-progran"] ]'
+{{- else if and .Values.fabric.enabled (not .Values.progran.enabled) }}
+        constraints: '[ [null, "mcord", "fabric"], ["cdn-remote", "omec-cp", "vrouter"], ["cdn-local", "omec-up", "onos"] ]'
+{{- else }}
+        constraints: '[ [null, "mcord"], ["cdn-remote", "omec-cp"], ["cdn-local", "omec-up"] ]'
+{{- end }}
+{{- end -}}
diff --git a/xos-profiles/mcord/templates/tosca-configmap.yaml b/xos-profiles/mcord-services/templates/tosca-configmap.yaml
similarity index 77%
rename from xos-profiles/mcord/templates/tosca-configmap.yaml
rename to xos-profiles/mcord-services/templates/tosca-configmap.yaml
index 1709094..9c2b807 100644
--- a/xos-profiles/mcord/templates/tosca-configmap.yaml
+++ b/xos-profiles/mcord-services/templates/tosca-configmap.yaml
@@ -19,21 +19,21 @@
 metadata:
   name: mcord-tosca
 data:
-  010-onos-service.yaml: |
-{{ include "mcord.onosTosca" .Values | indent 4 }}
 {{- if .Values.fabric.enabled }}
+  010-onos-fabric-service.yaml: |
+{{ include "mcord-services.onosFabricTosca" .Values | indent 4 }}
   020-fabric-service.yaml: |
 {{ include "fabric.serviceTosca" .Values.fabric | indent 4 }}
+  030-vrouter-service.yaml: |
+{{ include "vrouter.serviceTosca" .Values.vrouter | indent 4 }}
 {{- end }}
-  030-fixtures.yaml: |
-{{ include "mcord.fixtureTosca" . | indent 4 }}
 {{- if .Values.progran.enabled }}
-  040-progran-service.yaml: |
+  040-onos-progran-service.yaml: |
+{{ include "mcord-services.onosProgranTosca" .Values | indent 4 }}
+  050-progran-service.yaml: |
 {{ include "progran.serviceTosca" .Values.progran | indent 4 }}
 {{- end }}
-  050-vrouter-service.yaml: |
-{{ include "vrouter.serviceTosca" .Values.vrouter | indent 4 }}
   100-mcord-subscriber-service.yaml: |
 {{ include "mcord-subscriber.serviceTosca" (index .Values "mcord-subscriber") | indent 4 }}
   300-service-graph.yaml: |
-{{ include "mcord.serviceGraphTosca" . | indent 4 }}
+{{ include "mcord-services.serviceGraphTosca" . | indent 4 }}
diff --git a/xos-profiles/mcord/templates/tosca-job.yaml b/xos-profiles/mcord-services/templates/tosca-job.yaml
similarity index 100%
rename from xos-profiles/mcord/templates/tosca-job.yaml
rename to xos-profiles/mcord-services/templates/tosca-job.yaml
diff --git a/xos-profiles/mcord/values.yaml b/xos-profiles/mcord-services/values.yaml
similarity index 77%
rename from xos-profiles/mcord/values.yaml
rename to xos-profiles/mcord-services/values.yaml
index 15141a5..adca154 100644
--- a/xos-profiles/mcord/values.yaml
+++ b/xos-profiles/mcord-services/values.yaml
@@ -17,36 +17,27 @@
 # This is a YAML-formatted file.
 # Declare variables to be passed into your templates.
 
-replicaCount: 1
-
 nameOverride: ""
 fullnameOverride: ""
 
+global:
+  registry: ""
 images:
   tosca_loader:
     repository: 'xosproject/tosca-loader'
     tag: '{{ .Chart.AppVersion }}'
     pullPolicy: 'Always'
 
-global:
-  registry: ""
-
+# XOS
 xosAdminUser: "admin@opencord.org"
 xosAdminPassword: "letmein"
 
-cordSiteName: "mysite"
+# ONOS
+onosFabricRestService: "onos-ui.default.svc.cluster.local"
+onosProgranRestService: "onos-progran-ui.default.svc.cluster.local"
 
-onosRestService: "onos-ui.default.svc.cluster.local"
-kafkaService: "cord-kafka.default.svc.cluster.local:9092"
-
-# whether to install or not this shared services
+# Services
 fabric:
   enabled: true
-onos-service:
-  enabled: true
 progran:
   enabled: true
-
-# whether SEBA will be installed on the side or not
-seba:
-  enabled: false
\ No newline at end of file