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/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 }}