Expose ONOS ports as NodePorts

Change-Id: Ie01375b02197338a9af24a1f6177bc47d92f36e3
diff --git a/configs/onos-fabric.yaml b/configs/onos-fabric.yaml
new file mode 100644
index 0000000..ccdafce
--- /dev/null
+++ b/configs/onos-fabric.yaml
@@ -0,0 +1,30 @@
+---
+
+# Copyright 2018-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Expose ONOS services using NodePorts, for onos-fabric configuration
+#
+# helm install -f configs/onos-fabric.yaml onos
+
+services:
+  serviceType: NodePort
+  ovsdb:
+    nodePort: 31640
+  openflow:
+    nodePort: 31653
+  ssh:
+    nodePort: 31101
+  ui:
+    nodePort: 31181
diff --git a/examples/onos-nodeport-values.yaml b/examples/onos-nodeport-values.yaml
new file mode 100644
index 0000000..a28052e
--- /dev/null
+++ b/examples/onos-nodeport-values.yaml
@@ -0,0 +1,30 @@
+---
+
+# Copyright 2018-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Expose ONOS services using NodePorts
+#
+# helm install -f examples/onos-nodeport-values.yaml onos
+
+services:
+  serviceType: NodePort
+  ovsdb:
+    nodePort: 31640
+  openflow:
+    nodePort: 31653
+  ssh:
+    nodePort: 31101
+  ui:
+    nodePort: 31181
diff --git a/onos/templates/service.yaml b/onos/templates/openflow-service.yaml
similarity index 64%
copy from onos/templates/service.yaml
copy to onos/templates/openflow-service.yaml
index b1ada6f..c61f611 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/openflow-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-openflow
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: openflow
+{{ toYaml .Values.services.openflow | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}
diff --git a/onos/templates/service.yaml b/onos/templates/ovsdb-service.yaml
similarity index 64%
copy from onos/templates/service.yaml
copy to onos/templates/ovsdb-service.yaml
index b1ada6f..cfda477 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/ovsdb-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-ovsdb
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: ovsdb
+{{ toYaml .Values.services.ovsdb | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}
diff --git a/onos/templates/service.yaml b/onos/templates/ssh-service.yaml
similarity index 64%
copy from onos/templates/service.yaml
copy to onos/templates/ssh-service.yaml
index b1ada6f..fdcbb66 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/ssh-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-ssh
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: ssh
+{{ toYaml .Values.services.ssh | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}
diff --git a/onos/templates/service.yaml b/onos/templates/ui-service.yaml
similarity index 64%
rename from onos/templates/service.yaml
rename to onos/templates/ui-service.yaml
index b1ada6f..40cbd68 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/ui-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-ui
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: ui
+{{ toYaml .Values.services.ui | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}
diff --git a/onos/values.yaml b/onos/values.yaml
index 5aa184a..06e133b 100644
--- a/onos/values.yaml
+++ b/onos/values.yaml
@@ -26,6 +26,7 @@
   pullPolicy: IfNotPresent
 
 services:
+  serviceType: ClusterIP
   ovsdb:
     port: 6640
   openflow:
diff --git a/xos-profiles/rcord-lite/values.yaml b/xos-profiles/rcord-lite/values.yaml
index 5408334..f104177 100644
--- a/xos-profiles/rcord-lite/values.yaml
+++ b/xos-profiles/rcord-lite/values.yaml
@@ -198,7 +198,7 @@
                   relationship: tosca.relationships.BelongsToOne
           properties:
               name: rest_onos/v1/network/configuration/
-              value: ''
+              value: '{}'
         service#fabric:
           type: tosca.nodes.FabricService
           properties: