Update SEBA with preliminary support for SD-BNG

This change adds support for deploying SEBA using a Stratum-enabled
fabric switch, along with the necessary ONOS apps to provide SD-BNG
capabilities for PPPoE-based service delivery.

Some ONOS apps have been moved from the SEBA chart to the workflow ones,
such as dhcpl2relay and aaa. These apps are workflow dependent and they
are not needed with the current implementation of SD-BNG (which is based
on PPPoE).

Helm values can be used to deploy SEBA with or without SD-BNG (default).
If SD-BNG is enabled, then the vrouter ONOS app is deployed instead of
xconnect (as the BNG acts as a router).

Change-Id: Iaaa127e201f22133abb46212a3a8bc7c200495cf
diff --git a/workflows/att-workflow/Chart.yaml b/workflows/att-workflow/Chart.yaml
index f410b4e..7611871 100644
--- a/workflows/att-workflow/Chart.yaml
+++ b/workflows/att-workflow/Chart.yaml
@@ -17,7 +17,7 @@
 name: att-workflow
 description: A Helm chart for XOS's "att-workflow"
 icon: https://guide.opencord.org/logos/cord.svg
-version: 1.2.6
+version: 1.3.0
 
 # xosproject/tosca-loader version
 appVersion: 1.3.1
diff --git a/workflows/att-workflow/templates/_tosca.tpl b/workflows/att-workflow/templates/_tosca.tpl
index 073a5f3..593eafd 100644
--- a/workflows/att-workflow/templates/_tosca.tpl
+++ b/workflows/att-workflow/templates/_tosca.tpl
@@ -77,6 +77,19 @@
           name: onos
           must-exist: true
 
+    onos_app#dhcpl2relay:
+      type: tosca.nodes.ONOSApp
+      properties:
+        name: dhcpl2relay
+        app_id: org.opencord.dhcpl2relay
+        url: {{ .Values.dhcpl2relayAppUrl }}
+        version: {{ .Values.dhcpl2relayAppVersion }}
+        dependencies: org.opencord.sadis
+      requirements:
+        - owner:
+            node: service#onos
+            relationship: tosca.relationships.BelongsToOne
+
     onos_app#aaa:
       type: tosca.nodes.ONOSApp
       properties:
diff --git a/workflows/att-workflow/values.yaml b/workflows/att-workflow/values.yaml
index 2ed1e8c..1fb7091 100644
--- a/workflows/att-workflow/values.yaml
+++ b/workflows/att-workflow/values.yaml
@@ -39,3 +39,6 @@
 # ONOS applications
 aaaAppUrl: "https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.0.0/aaa-app-2.0.0.oar"
 aaaAppVersion: "2.0.0"
+
+dhcpl2relayAppUrl: "https://oss.sonatype.org/content/groups/public/org/opencord/dhcpl2relay-app/2.0.0/dhcpl2relay-app-2.0.0.oar"
+dhcpl2relayAppVersion: "2.0.0"
diff --git a/workflows/tt-workflow/Chart.yaml b/workflows/tt-workflow/Chart.yaml
index bf94c42..d8e2563 100644
--- a/workflows/tt-workflow/Chart.yaml
+++ b/workflows/tt-workflow/Chart.yaml
@@ -17,7 +17,7 @@
 name: tt-workflow
 description: A Helm chart for XOS's "tt-workflow"
 icon: https://guide.opencord.org/logos/cord.svg
-version: 0.1.4-dev
+version: 0.2.0-dev
 
 # xosproject/tosca-loader version
 appVersion: 1.3.1
diff --git a/workflows/tt-workflow/templates/_tosca.tpl b/workflows/tt-workflow/templates/_tosca.tpl
index 0888759..98bd5d6 100644
--- a/workflows/tt-workflow/templates/_tosca.tpl
+++ b/workflows/tt-workflow/templates/_tosca.tpl
@@ -77,6 +77,19 @@
           name: onos
           must-exist: true
 
+    onos_app#dhcpl2relay:
+      type: tosca.nodes.ONOSApp
+      properties:
+        name: dhcpl2relay
+        app_id: org.opencord.dhcpl2relay
+        url: {{ .Values.dhcpl2relayAppUrl }}
+        version: {{ .Values.dhcpl2relayAppVersion }}
+        dependencies: org.opencord.sadis
+      requirements:
+        - owner:
+            node: service#onos
+            relationship: tosca.relationships.BelongsToOne
+
     onos_app#olt:
       type: tosca.nodes.ONOSApp
       properties:
diff --git a/workflows/tt-workflow/values.yaml b/workflows/tt-workflow/values.yaml
index 61cea53..2a10b14 100644
--- a/workflows/tt-workflow/values.yaml
+++ b/workflows/tt-workflow/values.yaml
@@ -35,3 +35,6 @@
 
 xosAdminUser: "admin@opencord.org"
 xosAdminPassword: "letmein"
+
+dhcpl2relayAppUrl: "https://oss.sonatype.org/content/groups/public/org/opencord/dhcpl2relay-app/2.0.0/dhcpl2relay-app-2.0.0.oar"
+dhcpl2relayAppVersion: "2.0.0"
diff --git a/xos-profiles/seba-services/Chart.yaml b/xos-profiles/seba-services/Chart.yaml
index ab7a697..c4904b5 100644
--- a/xos-profiles/seba-services/Chart.yaml
+++ b/xos-profiles/seba-services/Chart.yaml
@@ -17,7 +17,7 @@
 name: seba-services
 description: A Helm chart for XOS's "SEBA" profile
 icon: https://guide.opencord.org/logos/cord.svg
-version: 1.3.0
+version: 1.4.0
 
 # xosproject/tosca-loader version
 appVersion: 1.3.1
diff --git a/xos-profiles/seba-services/requirements.yaml b/xos-profiles/seba-services/requirements.yaml
index 9ae5814..c56e8dd 100644
--- a/xos-profiles/seba-services/requirements.yaml
+++ b/xos-profiles/seba-services/requirements.yaml
@@ -23,14 +23,19 @@
   condition: onos-service.enabled
 - name: fabric
   version: 2.3.0
-  repository: file://../../xos-services/fabric
+  repository: https://charts.opencord.org
   condition: fabric.enabled
 - name: volt
   version: 2.2.5
   repository: https://charts.opencord.org
 - name: fabric-crossconnect
   version: 1.3.0
-  repository: file://../../xos-services/fabric-crossconnect
+  repository: https://charts.opencord.org
+  condition: bng.external.enabled
+- name: vrouter
+  version: 2.1.0
+  repository: https://charts.opencord.org
+  condition: bng.embedded.enabled
 - name: sadis-server
   version: 1.0.4
   repository: https://charts.opencord.org
diff --git a/xos-profiles/seba-services/templates/_tosca.tpl b/xos-profiles/seba-services/templates/_tosca.tpl
index 2f928a7..07de05a 100644
--- a/xos-profiles/seba-services/templates/_tosca.tpl
+++ b/xos-profiles/seba-services/templates/_tosca.tpl
@@ -14,7 +14,7 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 */}}
-{{- define "seba-services.onosTosca" -}}
+{{- define "seba-services.onosTosca" }}
 tosca_definitions_version: tosca_simple_yaml_1_0
 
 imports:
@@ -80,19 +80,6 @@
             node: service#onos
             relationship: tosca.relationships.BelongsToOne
 
-    onos_app#dhcpl2relay:
-      type: tosca.nodes.ONOSApp
-      properties:
-        name: dhcpl2relay
-        app_id: org.opencord.dhcpl2relay
-        url: {{ .dhcpl2relayAppUrl }}
-        version: {{ .dhcpl2relayAppVersion }}
-        dependencies: org.opencord.sadis
-      requirements:
-        - owner:
-            node: service#onos
-            relationship: tosca.relationships.BelongsToOne
-
     onos_app#kafka:
       type: tosca.nodes.ONOSApp
       properties:
@@ -162,6 +149,37 @@
             node: service#onos
             relationship: tosca.relationships.BelongsToOne
 
+{{- if .fabric.stratum.enabled }}
+    onos_app#fabric-pipeconf:
+      type: tosca.nodes.ONOSApp
+      properties:
+        name: {{ .fabric.stratum.pipeconfAppId }}
+        app_id: {{ .fabric.stratum.pipeconfAppId }}
+{{- if .fabric.stratum.pipeconfAppExternal }}
+        url: {{ .fabric.stratum.pipeconfAppUrl }}
+        version: {{ .fabric.stratum.pipeconfAppVersion }}
+{{- end }}
+      requirements:
+        - owner:
+            node: service#onos
+            relationship: tosca.relationships.BelongsToOne
+{{- end }}
+
+{{- if .bng.embedded.enabled }}
+    onos_app#bng:
+      type: tosca.nodes.ONOSApp
+      properties:
+        name: {{ .bng.embedded.bngAppId }}
+        app_id: {{ .bng.embedded.bngAppId }}
+        url: {{ .bng.embedded.bngAppUrl }}
+        version: {{ .bng.embedded.bngAppVersion }}
+        dependencies: {{ .fabric.stratum.pipeconfAppId }}, org.opencord.kafka, org.opencord.sadis
+      requirements:
+        - owner:
+            node: service#onos
+            relationship: tosca.relationships.BelongsToOne
+{{- end }}
+
     onos_app#netcfghostprovider:
       type: tosca.nodes.ONOSApp
       properties:
@@ -181,9 +199,9 @@
         - owner:
             node: service#onos
             relationship: tosca.relationships.BelongsToOne
-{{- end -}}
+{{- end }}
 
-{{- define "seba-services.basicFixturesTosca" -}}
+{{- define "seba-services.basicFixturesTosca" }}
 tosca_definitions_version: tosca_simple_yaml_1_0
 description: Some basic fixtures
 imports:
@@ -246,17 +264,22 @@
         translation: none
         shared_network_name: ext-net
 
-{{- end -}}
+{{- end }}
 
 
-{{- define "seba-services.serviceGraphTosca" -}}
+{{- define "seba-services.serviceGraphTosca" }}
 tosca_definitions_version: tosca_simple_yaml_1_0
 imports:
   - custom_types/fabricservice.yaml
   - custom_types/onosservice.yaml
   - custom_types/rcordservice.yaml
   - custom_types/voltservice.yaml
+{{- if .bng.external.enabled }}
   - custom_types/fabriccrossconnectservice.yaml
+{{- end }}
+{{- if .bng.embedded.enabled }}
+  - custom_types/vrouterservice.yaml
+{{- end }}
   - custom_types/servicedependency.yaml
   - custom_types/servicegraphconstraint.yaml
 description: seba service graph
@@ -289,12 +312,6 @@
         name: volt
         must-exist: true
 
-    service#fabric-crossconnect:
-      type: tosca.nodes.FabricCrossconnectService
-      properties:
-        name: fabric-crossconnect
-        must-exist: true
-
     service_dependency#onos-fabric_fabric:
       type: tosca.nodes.ServiceDependency
       properties:
@@ -331,6 +348,25 @@
             node: service#onos
             relationship: tosca.relationships.BelongsToOne
 
+    service_dependency#onos_rcord:
+      type: tosca.nodes.ServiceDependency
+      properties:
+        connect_method: none
+      requirements:
+        - subscriber_service:
+            node: service#rcord
+            relationship: tosca.relationships.BelongsToOne
+        - provider_service:
+            node: service#onos
+            relationship: tosca.relationships.BelongsToOne
+
+{{- if .bng.external.enabled }}
+    service#fabric-crossconnect:
+      type: tosca.nodes.FabricCrossconnectService
+      properties:
+        name: fabric-crossconnect
+        must-exist: true
+
     service_dependency#volt_fabric-crossconnect:
       type: tosca.nodes.ServiceDependency
       properties:
@@ -354,16 +390,26 @@
         - provider_service:
             node: service#onos
             relationship: tosca.relationships.BelongsToOne
+{{- end }}
 
-    service_dependency#onos_rcord:
+{{- if .bng.embedded.enabled }}
+    service#vrouter:
+      type: tosca.nodes.VRouterService
+      properties:
+        name: vrouter
+        must-exist: true
+
+    service_dependency#fabric_vrouter:
       type: tosca.nodes.ServiceDependency
       properties:
         connect_method: none
       requirements:
         - subscriber_service:
-            node: service#rcord
+            node: service#vrouter
             relationship: tosca.relationships.BelongsToOne
         - provider_service:
-            node: service#onos
+            node: service#fabric
             relationship: tosca.relationships.BelongsToOne
-{{- end -}}
+{{- end }}
+
+{{- end }}
diff --git a/xos-profiles/seba-services/templates/tosca-configmap.yaml b/xos-profiles/seba-services/templates/tosca-configmap.yaml
index 3b78537..f9f56b9 100644
--- a/xos-profiles/seba-services/templates/tosca-configmap.yaml
+++ b/xos-profiles/seba-services/templates/tosca-configmap.yaml
@@ -23,8 +23,14 @@
 {{ include "rcord.serviceTosca" .Values.rcord | indent 4 }}
   030-volt-service.yaml: |
 {{ include "volt.serviceTosca" .Values.volt | indent 4 }}
+{{- if .Values.bng.external.enabled }}
   040-fabric-crossconnect-service.yaml: |
 {{ include "fabric-crossconnect.serviceTosca" (index .Values "fabric-crossconnect") | indent 4 }}
+{{- end }}
+{{- if .Values.bng.embedded.enabled }}
+  040-vrouter-service.yaml: |
+{{ include "vrouter.serviceTosca" (index .Values "vrouter") | indent 4 }}
+{{- end }}
   061-onos-service.yaml: |
 {{ include "seba-services.onosTosca" .Values | indent 4 }}
 {{- if .Values.fabric.enabled }}
@@ -32,4 +38,4 @@
 {{ include "fabric.serviceTosca" .Values.fabric | indent 4 }}
 {{- end }}
   300-service-graph.yaml: |
-{{ include "seba-services.serviceGraphTosca" . | indent 4 }}
+{{ include "seba-services.serviceGraphTosca" .Values | indent 4 }}
diff --git a/xos-profiles/seba-services/values.yaml b/xos-profiles/seba-services/values.yaml
index 41ba27f..551ae3f 100644
--- a/xos-profiles/seba-services/values.yaml
+++ b/xos-profiles/seba-services/values.yaml
@@ -55,8 +55,32 @@
 onosRestService: "onos-ui.default.svc.cluster.local"
 kafkaService: "cord-kafka.default.svc.cluster.local:9092"
 
-# whether to install or not this shared services
+# Whether to install or not the fabric service.
 fabric:
   enabled: true
+  # Whether the fabric uses Stratum or not, and the corresponding ONOS apps
+  # required to control the switch.
+  stratum:
+    enabled: false
+    # The ONOS driver to control the fabric switch
+    driverAppId: "org.onosproject.drivers.barefoot"
+    # Whether the app providing the pipeconf must be installed to ONOS from an
+    # external URL (pipeconfAppUrl). If false, the pipeconf app is assumed to be
+    # pre-installed in ONOS.
+    pipeconfAppExternal: true
+    pipeconfAppId: "org.opencord.fabric-tofino"
+    pipeconfAppUrl: "https://repo1.maven.org/maven2/org/opencord/fabric-tofino/1.0.0/fabric-tofino-1.0.0.oar"
+    pipeconfAppVersion: "1.0.0"
+
 onos-service:
   enabled: true
+
+# Whether the BNG is external or embedded
+bng:
+  external:
+    enabled: true
+  embedded:
+    enabled: false
+    bngAppId: "org.opencord.bng"
+    bngAppUrl: "https://oss.sonatype.org/content/groups/public/org/opencord/bng/1.0.0/bng-1.0.0.oar"
+    bngAppVersion: "1.0.0"