Skip to content

Commit

Permalink
SEBA-686 Enable multiple Ponsim OLTs
Browse files Browse the repository at this point in the history
Change-Id: Ia8cc47492010bcd98f0a8800f70386cd5ca5342b
  • Loading branch information
andybavier committed Jun 3, 2019
1 parent 596e14e commit e21a5f5
Show file tree
Hide file tree
Showing 26 changed files with 190 additions and 99 deletions.
4 changes: 2 additions & 2 deletions configs/seba-ponsim-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ images:
tag: 'master'
# ONOS
onos:
repository: 'matteoscandolo/onos'
tag: '1.13.9-rc4'
# VOLTHA
vcore:
Expand Down Expand Up @@ -82,7 +81,7 @@ onos-service:
sadis-server:
image:
tag: 'latest'
olt-service:
volt:
image:
tag: 'master'
rcord:
Expand Down Expand Up @@ -116,6 +115,7 @@ enableMulticast: True

# in ponsim-pod chart
bandwidthProfiles: True
legacyPonsim: False

# ONOS applications
aaaAppUrl: "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.opencord&a=aaa-app&v=1.9.0-SNAPSHOT&e=oar"
Expand Down
4 changes: 2 additions & 2 deletions configs/seba-ponsim-voltha-1.7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ images:

# ONOS
onos:
repository: 'matteoscandolo/onos'
tag: '1.13.9-rc4'

# VOLTHA
Expand Down Expand Up @@ -84,7 +83,7 @@ onos-service:
sadis-server:
image:
tag: 'latest'
olt-service:
volt:
image:
tag: '2.2.1'
rcord:
Expand Down Expand Up @@ -118,6 +117,7 @@ enableMulticast: True

# in ponsim-pod chart
bandwidthProfiles: True
legacyPonsim: False

# ONOS applications
aaaAppUrl: "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.opencord&a=aaa-app&v=1.9.0-SNAPSHOT&e=oar"
Expand Down
2 changes: 1 addition & 1 deletion mininet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Mininet
name: mininet
version: 0.4.1
version: 0.5.0
19 changes: 19 additions & 0 deletions mininet/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ Create chart name and version as used by the chart label.
{{- define "mininet.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Generate the CNI annotations depending on number of OLTs
*/}}
{{- define "mininet.cni" -}}
{{- printf "calico" -}}
{{- range $i, $junk := until (.Values.numOlts|int) -}}
{{- printf ",nni%d" $i -}}
{{- end -}}
{{- end -}}

{{/*
Generate the DHCP subnets depending on number of OLTs
*/}}
{{- define "mininet.dhcp_range" -}}
{{- range $i, $junk := until (.Values.numOlts|int) -}}
{{- printf " --dhcp-range=172.18.%d.50,172.18.%d.150,12h" $i $i -}}
{{- end -}}
{{- end -}}
4 changes: 1 addition & 3 deletions mininet/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ spec:
labels:
app: {{ template "mininet.name" . }}
release: {{ .Release.Name }}
{{- with .Values.annotations }}
annotations:
{{ toYaml . | indent 8 }}
{{- end }}
cni: {{ template "mininet.cni" . }}
spec:
containers:
- name: {{ .Chart.Name }}
Expand Down
42 changes: 26 additions & 16 deletions mininet/toposcripts/topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,34 @@
net.addLink( h1, s2 )
net.addLink( h2, s2 )

info( '*** Adding hardware interface eth1 to switch %s\n' % s1.name)
_intf = Intf( 'eth1', node=s1 )

info( '*** Turning off checksum offloading for eth1\n' )
print quietRun( 'ethtool -K eth1 tx off rx off' )

info( '*** Adding VLAN interface to host %s\n' % h1.name)
base = "%s-eth0" % h1.name
h1.cmd( 'ifconfig %s-eth1 10.1.0.1/24 up' % h1.name)
h1.cmd( 'ip link add link %s name %s.222 type vlan proto 802.1Q id 222' % (base, base))
h1.cmd( 'ip link add link %s.222 name %s.222.111 type vlan proto 802.1Q id 111' % (base, base))
h1.cmd( 'ifconfig %s.222 up' % base)
h1.cmd( 'ifconfig %s.222.111 up' % base)
h1.cmd( 'ifconfig %s.222.111 172.18.0.10/24' % base)
h1.cmd( 'dnsmasq --dhcp-range=172.18.0.50,172.18.0.150,12h' )
{{- range $i, $junk := until (.Values.numOlts|int) -}}
{{- $intf := printf "eth%d" (add $i 1) }}

info( '*** Adding hardware interface {{ $intf }} to switch s1\n')
_intf = Intf( '{{ $intf }}', node=s1 )

info( '*** Turning off checksum offloading for {{ $intf }}\n' )
print quietRun( 'ethtool -K {{ $intf }} tx off rx off' )
{{- end }}

info( '*** Adding VLAN interface to host h1\n')
h1.cmd( 'ifconfig h1-eth1 10.1.0.1/24 up')

{{- range $i, $junk := until (.Values.numOlts|int) -}}
{{- $stag := add 222 $i }}
{{- $ctag := 111 }}

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' )
{{- end }}

h1.cmd( 'dnsmasq {{ template "mininet.dhcp_range" . }}' )

{{- if .Values.enableMulticast }}
info( '*** Start multicast routing on %s and source on %s\n' % (h1.name, h2.name))
info( '*** Start multicast routing on h1 and source on h2\n')
h1.cmd( 'service pimd start' )
h2.cmd( 'mcjoin -s -i h2-eth0 -t 2 >& /tmp/mcjoin.log &')
{{- end }}
Expand Down
4 changes: 1 addition & 3 deletions mininet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ affinity:
- olt
topologyKey: kubernetes.io/hostname

annotations:
cni: "calico,pon1"

onosOpenflowSvc: "onos-openflow.default.svc.cluster.local"
vlanMatchDepth: 1
enableMulticast: false
numOlts: 1
2 changes: 1 addition & 1 deletion ponnet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.

name: ponnet
version: 1.1.0
version: 1.2.0
14 changes: 8 additions & 6 deletions ponnet/templates/ponnet-cni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,32 @@ metadata:
name: ponnet-config
namespace: kube-system
data:
pon0.conf: |
{{- range $i, $junk := until (.Values.numOlts|int) }}
pon{{ $i }}.conf: |
{
"name": "pon0",
"name": "pon{{ $i }}",
"type": "bridge",
"bridge": "pon0",
"bridge": "pon{{ $i }}",
"isGateway": false,
"ipMask": false,
"ipam": {
"type": "host-local",
"subnet": "10.22.0.0/16"
}
}
pon1.conf: |
nni{{ $i }}.conf: |
{
"name": "pon1",
"name": "nni{{ $i }}",
"type": "bridge",
"bridge": "pon1",
"bridge": "nni{{ $i }}",
"isGateway": false,
"ipMask": false,
"ipam": {
"type": "host-local",
"subnet": "10.23.0.0/16"
}
}
{{- end }}

---
# Install Ponnnet CNI conf on each slave node.
Expand Down
2 changes: 2 additions & 0 deletions ponnet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ images:

global:
namespace: voltha

numOlts: 1
2 changes: 1 addition & 1 deletion ponsimv2/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name: ponsimv2
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
25 changes: 14 additions & 11 deletions ponsimv2/templates/olt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -71,3 +73,4 @@ spec:
ports:
- containerPort: 50060
name: grpc-port
{{- end }}
33 changes: 20 additions & 13 deletions ponsimv2/templates/onu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -52,12 +54,12 @@ spec:
- 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:
Expand All @@ -72,15 +74,20 @@ spec:
- "-device_type"
- "ONU"
- "-parent_addr"
- "olt"
- "olt{{ $i }}"
- "-grpc_port"
- "50061"
- "-internal_if"
- "eth0"
- "-external_if"
- "eth1"
- "-promiscuous"
{{- if not $.Values.legacyPonsim }}
- "-serial_number"
- "PSMO{{ printf "%04d" $i }}0000"
{{- end }}

ports:
- containerPort: 50061
name: grpc-port
{{- end }}

0 comments on commit e21a5f5

Please sign in to comment.