SEBA-686 Enable multiple Ponsim OLTs
Change-Id: Ia8cc47492010bcd98f0a8800f70386cd5ca5342b
diff --git a/ponsimv2/Chart.yaml b/ponsimv2/Chart.yaml
index 296e6a1..45bf595 100644
--- a/ponsimv2/Chart.yaml
+++ b/ponsimv2/Chart.yaml
@@ -17,7 +17,7 @@
description: PON Simulator
icon: https://guide.opencord.org/logos/cord.svg
-version: 1.0.3
+version: 1.1.0
# VOLTHA version
appVersion: 1.6.0
diff --git a/ponsimv2/templates/olt.yaml b/ponsimv2/templates/olt.yaml
index 8026068..3f03ed5 100644
--- a/ponsimv2/templates/olt.yaml
+++ b/ponsimv2/templates/olt.yaml
@@ -13,39 +13,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+{{- range $i, $junk := until (.Values.numOlts|int) }}
+---
apiVersion: v1
kind: Service
metadata:
- name: olt
- namespace: {{ .Values.global.namespace }}
+ name: olt{{ $i }}
+ namespace: {{ $.Values.global.namespace }}
labels:
- name: olt
+ name: olt{{ $i }}
spec:
ports:
- name: grpc
port: 50060
targetPort: 50060
selector:
- app: olt
+ app: olt{{ $i }}
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
- name: olt
- namespace: {{ .Values.global.namespace }}
+ name: olt{{ $i }}
+ namespace: {{ $.Values.global.namespace }}
spec:
replicas: 1
template:
metadata:
labels:
- app: olt
+ app: olt{{ $i }}
annotations:
- cni: "calico,pon1"
+ cni: "calico,nni{{ $i }}"
spec:
containers:
- - name: olt
- image: "{{ .Values.global.registry }}{{ .Values.images.olt.repository }}:{{ tpl .Values.images.olt.tag . }}"
- imagePullPolicy: {{ .Values.images.olt.pullPolicy }}
+ - name: olt{{ $i }}
+ image: "{{ $.Values.global.registry }}{{ $.Values.images.olt.repository }}:{{ tpl $.Values.images.olt.tag $ }}"
+ imagePullPolicy: {{ $.Values.images.olt.pullPolicy }}
env:
- name: POD_IP
valueFrom:
@@ -71,3 +73,4 @@
ports:
- containerPort: 50060
name: grpc-port
+{{- end }}
\ No newline at end of file
diff --git a/ponsimv2/templates/onu.yaml b/ponsimv2/templates/onu.yaml
index 6179fc2..debb013 100644
--- a/ponsimv2/templates/onu.yaml
+++ b/ponsimv2/templates/onu.yaml
@@ -13,34 +13,36 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+{{- range $i, $junk := until (.Values.numOlts|int) }}
+---
apiVersion: v1
kind: Service
metadata:
- name: onu
- namespace: {{ .Values.global.namespace }}
+ name: onu{{ $i }}
+ namespace: {{ $.Values.global.namespace }}
labels:
- name: onu
+ name: onu{{ $i }}
spec:
ports:
- name: grpc
port: 50061
targetPort: 50061
selector:
- app: onu
+ app: onu{{ $i }}
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
- name: onu
- namespace: {{ .Values.global.namespace }}
+ name: onu{{ $i }}
+ namespace: {{ $.Values.global.namespace }}
spec:
replicas: 1
template:
metadata:
labels:
- app: onu
+ app: onu{{ $i }}
annotations:
- cni: "calico,pon0"
+ cni: "calico,pon{{ $i }}"
spec:
affinity:
podAffinity:
@@ -52,12 +54,12 @@
- key: app
operator: In
values:
- - rg
+ - rg{{ $i }}
topologyKey: kubernetes.io/hostname
containers:
- - name: onu
- image: "{{ .Values.global.registry }}{{ .Values.images.onu.repository }}:{{ tpl .Values.images.onu.tag . }}"
- imagePullPolicy: {{ .Values.images.onu.pullPolicy }}
+ - name: onu{{ $i }}
+ image: "{{ $.Values.global.registry }}{{ $.Values.images.onu.repository }}:{{ tpl $.Values.images.onu.tag $ }}"
+ imagePullPolicy: {{ $.Values.images.onu.pullPolicy }}
env:
- name: POD_IP
valueFrom:
@@ -72,7 +74,7 @@
- "-device_type"
- "ONU"
- "-parent_addr"
- - "olt"
+ - "olt{{ $i }}"
- "-grpc_port"
- "50061"
- "-internal_if"
@@ -80,7 +82,12 @@
- "-external_if"
- "eth1"
- "-promiscuous"
+{{- if not $.Values.legacyPonsim }}
+ - "-serial_number"
+ - "PSMO{{ printf "%04d" $i }}0000"
+{{- end }}
ports:
- containerPort: 50061
name: grpc-port
+{{- end }}
\ No newline at end of file
diff --git a/ponsimv2/templates/rg.yaml b/ponsimv2/templates/rg.yaml
index e96c59c..ae3203c 100644
--- a/ponsimv2/templates/rg.yaml
+++ b/ponsimv2/templates/rg.yaml
@@ -13,19 +13,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+{{- range $i, $junk := until (.Values.numOlts|int) }}
+---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
- name: rg
- namespace: {{ .Values.global.namespace }}
+ name: rg{{ $i }}
+ namespace: {{ $.Values.global.namespace }}
spec:
replicas: 1
template:
metadata:
labels:
- app: rg
+ app: rg{{ $i }}
annotations:
- cni: "pon0"
+ cni: "pon{{ $i }}"
spec:
affinity:
podAffinity:
@@ -37,12 +39,12 @@
- key: app
operator: In
values:
- - onu
+ - onu{{ $i }}
topologyKey: kubernetes.io/hostname
containers:
- - name: rg
- image: "{{ .Values.global.registry }}{{ .Values.images.rg.repository }}:{{ tpl .Values.images.rg.tag . }}"
- imagePullPolicy: {{ .Values.images.rg.pullPolicy }}
+ - name: rg{{ $i }}
+ image: "{{ $.Values.global.registry }}{{ $.Values.images.rg.repository }}:{{ tpl $.Values.images.rg.tag $ }}"
+ imagePullPolicy: {{ $.Values.images.rg.pullPolicy }}
env:
- name: POD_IP
valueFrom:
@@ -55,3 +57,4 @@
command: [ "/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait" ]
securityContext:
privileged: true
+{{- end }}
\ No newline at end of file
diff --git a/ponsimv2/values.yaml b/ponsimv2/values.yaml
index 9fa6c0a..42434b5 100644
--- a/ponsimv2/values.yaml
+++ b/ponsimv2/values.yaml
@@ -34,3 +34,9 @@
global:
namespace: voltha
registry: ''
+
+# numOlts > 1 only works with voltha-1.7 or greater
+numOlts: 1
+
+# legacyPonsim == true means that we are using voltha-1.6
+legacyPonsim: true