[VOL-2864] Include log_level parameter in BBSIM helm chart
[VOL-2856] Supporting defaults helm-chart arguments

Change-Id: Ibb507015fb50568aa126e5742af233177a65216e
diff --git a/bbsim/Chart.yaml b/bbsim/Chart.yaml
index 517e4c5..ffecb11 100644
--- a/bbsim/Chart.yaml
+++ b/bbsim/Chart.yaml
@@ -16,5 +16,5 @@
 description: Broadband Simulator
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 3.0.18
+version: 3.0.19
 appVersion: 0.1.0
diff --git a/bbsim/templates/deployment.yaml b/bbsim/templates/deployment.yaml
index 02434d5..3a5b91a 100644
--- a/bbsim/templates/deployment.yaml
+++ b/bbsim/templates/deployment.yaml
@@ -12,6 +12,7 @@
 # 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.
+{{- $log_level := tpl .Values.log_level . }}
 
 apiVersion: extensions/v1beta1
 kind: Deployment
@@ -39,8 +40,8 @@
       serviceAccountName: {{ .Values.serviceAccountName }}
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.global.registry }}{{ .Values.images.bbsim.repository }}:{{ tpl .Values.images.bbsim.tag . }}
-          imagePullPolicy: {{ .Values.images.bbsim.pullPolicy }}
+          image: '{{ tpl .Values.images.bbsim.registry . }}{{ tpl .Values.images.bbsim.repository . }}:{{ tpl ( tpl .Values.images.bbsim.tag . ) . }}'
+          imagePullPolicy: {{ tpl .Values.images.bbsim.pullPolicy . }}
           securityContext:
             privileged: true
           command: [
@@ -49,6 +50,7 @@
             "-nni", "{{ .Values.nni }}",
             "-pon", "{{ .Values.pon }}",
             "-onu", "{{ .Values.onu }}",
+            "-logLevel", "{{ $log_level }}",
             {{ if .Values.auth -}}
             "-auth",
             {{ end -}}
diff --git a/bbsim/values.yaml b/bbsim/values.yaml
index bbd5afd..f9a4e2e 100644
--- a/bbsim/values.yaml
+++ b/bbsim/values.yaml
@@ -14,8 +14,15 @@
 
 # bbsim values
 
-# CLI switches passed to bbsim
+# Default overrides
+defaults:
+  log_level: "DEBUG"
+  image_registry: ""
+  image_tag: ~
+  image_org: "voltha/"
+  image_pullPolicy: "Always"
 
+# CLI switches passed to bbsim
 olt_id: 0
 nni: 1
 pon: 1
@@ -25,6 +32,7 @@
 delay: 200
 c_tag: 900
 s_tag: 900
+log_level: '{{ .Values.defaults.log_level }}'
 
 # TODO read this values in the config
 olt_tcp_port: 50060
@@ -36,9 +44,10 @@
 
 images:
   bbsim:
-    repository: 'voltha/bbsim'
-    tag: '{{ .Chart.AppVersion }}'
-    pullPolicy: 'Always'
+    registry: '{{ .Values.defaults.image_registry }}'
+    repository: '{{ .Values.defaults.image_org }}bbsim'
+    tag: '{{- if hasKey .Values.defaults "image_tag" }}{{- if .Values.defaults.image_tag }}{{ .Values.defaults.image_tag }}{{- else }}{{ .Chart.AppVersion }}{{- end }}{{- else }}{{ .Chart.AppVersion }}{{- end }}'
+    pullPolicy: '{{ .Values.defaults.image_pullPolicy | default "Always" }}'
 
 global:
   registry: ''