Multiple ponsimONU support - template updates
Change-Id: I1b4c79f61e0d0f9b566c09517c939bee890b41a3
diff --git a/mininet/Chart.yaml b/mininet/Chart.yaml
index fdc6e9b..9619440 100644
--- a/mininet/Chart.yaml
+++ b/mininet/Chart.yaml
@@ -17,4 +17,4 @@
appVersion: "1.0"
description: A Helm chart for Mininet
name: mininet
-version: 0.5.0
+version: 0.5.1
diff --git a/mininet/templates/_helpers.tpl b/mininet/templates/_helpers.tpl
index 8396f02..4719e95 100644
--- a/mininet/templates/_helpers.tpl
+++ b/mininet/templates/_helpers.tpl
@@ -61,7 +61,10 @@
Generate the DHCP subnets depending on number of OLTs
*/}}
{{- define "mininet.dhcp_range" -}}
+{{- $onucount := .Values.numOnus|int}}
{{- range $i, $junk := until (.Values.numOlts|int) -}}
-{{- printf " --dhcp-range=172.18.%d.50,172.18.%d.150,12h" $i $i -}}
+{{- range $j, $junk1 := until ($onucount) -}}
+{{- printf " --dhcp-range=172.%d.%d.50,172.%d.%d.150,12h" (add $i 18) $j (add $i 18) $j -}}
{{- end -}}
-{{- end -}}
\ No newline at end of file
+{{- end -}}
+{{- end -}}
diff --git a/mininet/toposcripts/topo.py b/mininet/toposcripts/topo.py
index 8e8b6c4..121bb38 100644
--- a/mininet/toposcripts/topo.py
+++ b/mininet/toposcripts/topo.py
@@ -72,17 +72,18 @@
info( '*** Adding VLAN interface to host h1\n')
h1.cmd( 'ifconfig h1-eth1 10.1.0.1/24 up')
+ {{- $onucount := .Values.numOnus|int}}
{{- range $i, $junk := until (.Values.numOlts|int) -}}
{{- $stag := add 222 $i }}
-{{- $ctag := 111 }}
-
+{{- range $j, $junk1 := until ($onucount) -}}
+{{- $ctag := add 111 $j }}
h1.cmd( 'ip link add link h1-eth0 name h1-eth0.{{ $stag }} type vlan proto 802.1Q id {{ $stag }}' )
h1.cmd( 'ip link add link h1-eth0.{{ $stag }} name h1-eth0.{{ $stag }}.{{ $ctag }} type vlan proto 802.1Q id {{ $ctag }}' )
h1.cmd( 'ifconfig h1-eth0.{{ $stag }} up' )
h1.cmd( 'ifconfig h1-eth0.{{ $stag }}.{{ $ctag }} up' )
- h1.cmd( 'ifconfig h1-eth0.{{ $stag }}.{{ $ctag }} 172.18.{{ $i }}.10/24' )
+ h1.cmd( 'ifconfig h1-eth0.{{ $stag }}.{{ $ctag }} 172.{{ add $i 18 }}.{{ $j }}.10/24' )
{{- end }}
-
+{{- end }}
h1.cmd( 'dnsmasq {{ template "mininet.dhcp_range" . }}' )
{{- if .Values.enableMulticast }}
diff --git a/mininet/values.yaml b/mininet/values.yaml
index 2a049d4..9bab69a 100644
--- a/mininet/values.yaml
+++ b/mininet/values.yaml
@@ -49,3 +49,4 @@
vlanMatchDepth: 1
enableMulticast: false
numOlts: 1
+numOnus: 1
diff --git a/ponnet/Chart.yaml b/ponnet/Chart.yaml
index 959032f..54448af 100644
--- a/ponnet/Chart.yaml
+++ b/ponnet/Chart.yaml
@@ -14,4 +14,4 @@
# limitations under the License.
name: ponnet
-version: 1.2.0
+version: 1.2.1
diff --git a/ponnet/templates/ponnet-cni.yaml b/ponnet/templates/ponnet-cni.yaml
index a3cf4f8..c72abab 100644
--- a/ponnet/templates/ponnet-cni.yaml
+++ b/ponnet/templates/ponnet-cni.yaml
@@ -90,19 +90,8 @@
name: ponnet-config
namespace: kube-system
data:
+{{- $onucount := (.Values.numOnus|int) -}}
{{- range $i, $junk := until (.Values.numOlts|int) }}
- pon{{ $i }}.conf: |
- {
- "name": "pon{{ $i }}",
- "type": "bridge",
- "bridge": "pon{{ $i }}",
- "isGateway": false,
- "ipMask": false,
- "ipam": {
- "type": "host-local",
- "subnet": "10.22.0.0/16"
- }
- }
nni{{ $i }}.conf: |
{
"name": "nni{{ $i }}",
@@ -115,8 +104,21 @@
"subnet": "10.23.0.0/16"
}
}
+{{- range $j, $junk1 := until ($onucount) }}
+ pon{{ $i }}.{{ $j }}.conf: |
+ {
+ "name": "pon{{ $i }}.{{ $j }}",
+ "type": "bridge",
+ "bridge": "pon{{ $i }}.{{ $j }}",
+ "isGateway": false,
+ "ipMask": false,
+ "ipam": {
+ "type": "host-local",
+ "subnet": "10.22.0.0/16"
+ }
+ }
{{- end }}
-
+{{- end }}
---
# Install Ponnnet CNI conf on each slave node.
kind: DaemonSet
diff --git a/ponnet/values.yaml b/ponnet/values.yaml
index 759bd95..641e7a1 100644
--- a/ponnet/values.yaml
+++ b/ponnet/values.yaml
@@ -24,4 +24,5 @@
global:
namespace: voltha
-numOlts: 1
+numOlts: 1
+numOnus: 1
diff --git a/ponsimv2/Chart.yaml b/ponsimv2/Chart.yaml
index 45bf595..567aac7 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.1.0
+version: 1.1.1
# VOLTHA version
appVersion: 1.6.0
diff --git a/ponsimv2/templates/onu.yaml b/ponsimv2/templates/onu.yaml
index debb013..f297546 100644
--- a/ponsimv2/templates/onu.yaml
+++ b/ponsimv2/templates/onu.yaml
@@ -13,36 +13,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+{{- $onucount := (.Values.numOnus|int)}}
{{- range $i, $junk := until (.Values.numOlts|int) }}
+{{- range $j, $junk1 := until ($onucount) }}
---
apiVersion: v1
kind: Service
metadata:
- name: onu{{ $i }}
+ name: onu{{ $i }}-{{ $j }}
namespace: {{ $.Values.global.namespace }}
labels:
- name: onu{{ $i }}
+ name: onu{{ $i }}-{{ $j }}
spec:
ports:
- name: grpc
port: 50061
targetPort: 50061
selector:
- app: onu{{ $i }}
+ app: onu{{ $i }}-{{ $j }}
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
- name: onu{{ $i }}
+ name: onu{{ $i }}-{{ $j }}
namespace: {{ $.Values.global.namespace }}
spec:
replicas: 1
template:
metadata:
labels:
- app: onu{{ $i }}
+ app: onu{{ $i }}-{{ $j }}
annotations:
- cni: "calico,pon{{ $i }}"
+ cni: "calico,pon{{ $i }}.{{ $j }}"
spec:
affinity:
podAffinity:
@@ -54,10 +56,10 @@
- key: app
operator: In
values:
- - rg{{ $i }}
+ - rg{{ $i }}-{{ $j }}
topologyKey: kubernetes.io/hostname
containers:
- - name: onu{{ $i }}
+ - name: onu{{ $i }}-{{ $j }}
image: "{{ $.Values.global.registry }}{{ $.Values.images.onu.repository }}:{{ tpl $.Values.images.onu.tag $ }}"
imagePullPolicy: {{ $.Values.images.onu.pullPolicy }}
env:
@@ -84,10 +86,11 @@
- "-promiscuous"
{{- if not $.Values.legacyPonsim }}
- "-serial_number"
- - "PSMO{{ printf "%04d" $i }}0000"
+ - "PSMO{{ printf "%04d%04d" $i $j }}"
+{{- end }}
{{- end }}
ports:
- containerPort: 50061
name: grpc-port
-{{- end }}
\ No newline at end of file
+{{- end }}
diff --git a/ponsimv2/templates/rg.yaml b/ponsimv2/templates/rg.yaml
index ae3203c..44eb1e6 100644
--- a/ponsimv2/templates/rg.yaml
+++ b/ponsimv2/templates/rg.yaml
@@ -13,21 +13,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+{{- $rgcount := (.Values.numOnus|int) }}
{{- range $i, $junk := until (.Values.numOlts|int) }}
+{{- range $j, $junk1 := until ($rgcount) }}
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
- name: rg{{ $i }}
+ name: rg{{ $i }}-{{ $j }}
namespace: {{ $.Values.global.namespace }}
spec:
replicas: 1
template:
metadata:
labels:
- app: rg{{ $i }}
+ app: rg{{ $i }}-{{ $j }}
annotations:
- cni: "pon{{ $i }}"
+ cni: "pon{{ $i }}.{{ $j }}"
spec:
affinity:
podAffinity:
@@ -39,10 +41,10 @@
- key: app
operator: In
values:
- - onu{{ $i }}
+ - onu{{ $i }}-{{ $j }}
topologyKey: kubernetes.io/hostname
containers:
- - name: rg{{ $i }}
+ - name: rg{{ $i }}-{{ $j }}
image: "{{ $.Values.global.registry }}{{ $.Values.images.rg.repository }}:{{ tpl $.Values.images.rg.tag $ }}"
imagePullPolicy: {{ $.Values.images.rg.pullPolicy }}
env:
@@ -57,4 +59,5 @@
command: [ "/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait" ]
securityContext:
privileged: true
-{{- end }}
\ No newline at end of file
+{{- end }}
+{{- end }}
diff --git a/ponsimv2/values.yaml b/ponsimv2/values.yaml
index 42434b5..045644d 100644
--- a/ponsimv2/values.yaml
+++ b/ponsimv2/values.yaml
@@ -37,6 +37,6 @@
# numOlts > 1 only works with voltha-1.7 or greater
numOlts: 1
-
+numOnus: 1
# legacyPonsim == true means that we are using voltha-1.6
legacyPonsim: true
diff --git a/xos-profiles/ponsim-pod/Chart.yaml b/xos-profiles/ponsim-pod/Chart.yaml
index 6a714bb..3bce47f 100644
--- a/xos-profiles/ponsim-pod/Chart.yaml
+++ b/xos-profiles/ponsim-pod/Chart.yaml
@@ -17,7 +17,7 @@
description: A Helm chart for loading the Ponsim pod's TOSCA files into XOS
icon: https://guide.opencord.org/logos/xos.svg
-version: 1.3.0
+version: 1.3.1
# xosproject/tosca-loader version
appVersion: 1.3.1
diff --git a/xos-profiles/ponsim-pod/tosca/040-subscriber.yaml b/xos-profiles/ponsim-pod/tosca/040-subscriber.yaml
index 1263bd3..9b13427 100644
--- a/xos-profiles/ponsim-pod/tosca/040-subscriber.yaml
+++ b/xos-profiles/ponsim-pod/tosca/040-subscriber.yaml
@@ -20,6 +20,7 @@
- custom_types/bandwidthprofile.yaml
{{- end }}
+{{- $onucount := (.Values.numOnus|int) }}
description: Pre-provsion a subscriber
topology_template:
@@ -40,18 +41,18 @@
# Pre-provision the subscribers
{{- range $i, $junk := until (.Values.numOlts|int) }}
-
- house_{{ $i }}:
+{{- range $j, $junk1 := until ($onucount) }}
+ house_{{ $i }}-{{ $j }}:
type: tosca.nodes.RCORDSubscriber
properties:
- name: QQClient{{ $i }}
+ name: QQClient{{ $i }}-{{ $j }}
status: pre-provisioned
- c_tag: 111
+ c_tag: {{ add 111 $j }}
s_tag: {{ add 222 $i }}
{{- if $.Values.legacyPonsim }}
onu_device: PSMO12345678
{{- else }}
- onu_device: PSMO{{ printf "%04d" $i }}0000
+ onu_device: PSMO{{ printf "%04d%04d" $i $j }}
{{- end }}
{{- if $.Values.bandwidthProfiles }}
requirements:
@@ -62,4 +63,5 @@
node: bronze_bp
relationship: tosca.relationships.BelongsToOne
{{- end }}
-{{- end }}
\ No newline at end of file
+{{- end }}
+{{- end }}
diff --git a/xos-profiles/ponsim-pod/tosca/att-workflow/010-att-workflow.yaml b/xos-profiles/ponsim-pod/tosca/att-workflow/010-att-workflow.yaml
index 419a51e..6dd34a2 100644
--- a/xos-profiles/ponsim-pod/tosca/att-workflow/010-att-workflow.yaml
+++ b/xos-profiles/ponsim-pod/tosca/att-workflow/010-att-workflow.yaml
@@ -22,6 +22,7 @@
- custom_types/attworkflowdriverwhitelistentry.yaml
- custom_types/attworkflowdriverservice.yaml
description: Create an instance of the OSS Service and connect it to the vOLT Service
+
topology_template:
node_templates:
@@ -31,16 +32,17 @@
name: att-workflow-driver
must-exist: true
+{{- $onucount := (.Values.numOnus|int) }}
{{- range $i, $junk := until (.Values.numOlts|int) }}
-
- whitelist{{ $i }}:
+{{- range $j, $junk1 := until ($onucount) }}
+ whitelist{{ $i }}-{{ $j }}:
type: tosca.nodes.AttWorkflowDriverWhiteListEntry
properties:
{{- if $.Values.legacyPonsim }}
serial_number: PSMO12345678
device_id: of:0000aabbccddeeff
{{- else }}
- serial_number: PSMO{{ printf "%04d" $i }}0000
+ serial_number: PSMO{{ printf "%04d%04d" $i $j }}
device_id: {{ index $.Values.oltDpids $i }}
{{- end }}
pon_port_id: 1
@@ -48,4 +50,5 @@
- owner:
node: service#att
relationship: tosca.relationships.BelongsToOne
-{{- end }}
\ No newline at end of file
+{{- end }}
+{{- end }}
diff --git a/xos-profiles/ponsim-pod/values.yaml b/xos-profiles/ponsim-pod/values.yaml
index bea12fb..2e0940e 100644
--- a/xos-profiles/ponsim-pod/values.yaml
+++ b/xos-profiles/ponsim-pod/values.yaml
@@ -41,7 +41,7 @@
# numOlts > 1 only works with voltha-1.7 or greater
numOlts: 1
-
+numOnus: 1
# legacyPonsim == true means that we are using voltha-1.6
legacyPonsim: true