VOLTHAの環境構築と試し方
VOLTHAとは
VOLTHA (Virtual OLT Hardware Abstraction) とは、光アクセス装置の仮想化を実現するためのオープンソースソフトウェアで、ベンダー毎やPON標準毎に異なる装置の制御や管理情報を抽象化する機能を持ちます。VOLTHAは一つのソフトウェアではなく、VOLTHAコア、アダプタ、kafka、etcdなどの複数の構成要素が連携することで動作します。また、実際の光アクセス装置の実機がなくても、BBSimというOLT、ONUのシミュレータがあり、サーバ内だけで構築し、試してみることができます。これらのソフトウェア環境の構築方法は2つ用意されており、Docker構成もしくはkubernetes構成で動作させることができます。環境構築方法と簡単な動作確認の方法を説明します。
サーバの環境構築
VOLTHAの推奨されている動作環境の構築方法を下に示します。
Ubuntu 16.04 or 18.04においてディストリビューションとパッケージの更新を行います。
sudo apt update
sudo apt dist-upgrade
Dockerとビルドツールのインストール。
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install build-essential docker-ce git
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod 755 /usr/local/bin/docker-compose
Go言語のインストール。
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-1.13
環境設定。(exportの部分は~/.profile
にも設定し、永続化する。)
mkdir $HOME/source
mkdir $HOME/go
export GO111MODULE=on
export GOPATH=$HOME/go
export DOCKER_TAG=latest
export PATH=$PATH:/usr/lib/go-1.13/bin:$GOPATH/bin
go version
Dockerをsudoなしで使うための設定。(一度ログアウトが必要)
sudo usermod -a -G docker $USER
kubernetes構成ではjqとyqを使用しますのでインストールします。 yq
がsnap
でしかインストール出来なかったので以下のようにしています。
sudo apt install jq
sudo apt install snap
sudo snap install yq
Docker構成の環境構築
VOLTHA core部分のソフトウェアのリポジトリ内にコンテナ一式を立ち上げるためのymlファイルがありますので、それを編集します。 https://github.com/opencord/voltha-go/blob/master/compose/system-test-bbsim.yml 以下のように書き換えます。
${DOCKER_REGISTRY}${DOCKER_REPOSITORY}
→voltha/
${DOCKER_TAG}
→VOLTHAのバージョン毎に各構成要素のバージョンの組み合わせが異なるので、VOLTHA docsで試したいVOLTHA Componentのバージョンを確認し、一つ一つ記載する。- BBSimのオプション指定方法が変更されており、
-auth
→-authRetry
,-dhcp
→-dhcpRetry
と変更する。
VOLTHA2.5を動作させたい時のymlファイルを示します。
---
# Copyright 2018 the original author or authors.
#
# 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.
version: '2'
networks:
default:
driver: bridge
services:
zookeeper:
image: "wurstmeister/zookeeper:latest"
environment:
SERVICE_2181_NAME: "zookeeper"
ports:
- 2181:2181
networks:
- default
restart: unless-stopped
kafka:
image: "wurstmeister/kafka:2.11-2.0.1"
environment:
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${DOCKER_HOST_IP}:9092
KAFKA_LISTENERS: PLAINTEXT://:9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
SERVICE_9092_NAME: "kafka"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- 9092:9092
networks:
- default
restart: unless-stopped
etcd:
image: "quay.io/coreos/etcd:v3.4.1"
command: [
"etcd",
"--name=etcd0",
"--advertise-client-urls=http://${DOCKER_HOST_IP}:2379,http://${DOCKER_HOST_IP}:4001",
"--listen-client-urls=http://0.0.0.0:2379,http://0.0.0.0:4001",
"--initial-advertise-peer-urls=http://${DOCKER_HOST_IP}:2380",
"--listen-peer-urls=http://0.0.0.0:2380",
"--initial-cluster-token=etcd-cluster-1",
"--initial-cluster=etcd0=http://${DOCKER_HOST_IP}:2380",
"--initial-cluster-state=new"
]
ports:
- "2379:2379"
- 2380
- 4001
networks:
- default
restart: unless-stopped
rw_core:
image: "voltha/voltha-rw-core:2.5.4"
entrypoint:
- /app/rw_core
- -kv_store_type=etcd
- -kv_store_address=${DOCKER_HOST_IP}:2379
- -banner=true
- -kafka_adapter_address=${DOCKER_HOST_IP}:9092
- -kafka_cluster_address=${DOCKER_HOST_IP}:9092
- -rw_core_topic=rwcore
- -in_competing_mode=false
- -log_level=DEBUG
volumes:
- "/var/run/docker.sock:/tmp/docker.sock"
ports:
- 50057:50057
networks:
- default
restart: unless-stopped
ofagent:
image: "voltha/voltha-ofagent-go:1.3.2"
command: [
"/app/ofagent",
"--controller=${DOCKER_HOST_IP}:6653",
"--voltha=${DOCKER_HOST_IP}:50057",
"--log_level=DEBUG"
]
volumes:
- "/var/run/docker.sock:/tmp/docker.sock"
networks:
- default
restart: unless-stopped
onos:
image: "voltha/voltha-onos:4.1.8"
ports:
- "8101:8101" # ssh
- "6653:6653" # OF
- "8181:8181" # UI
environment:
ONOS_APPS: 'drivers,openflow-base'
volumes:
- "/var/run/docker.sock:/tmp/docker.sock"
- "./network-cfg-bbsim.json:/root/onos/config/network-cfg.json"
networks:
- default
restart: unless-stopped
adapter_openolt:
image: "voltha/voltha-openolt-adapter:2.5.6"
command: [
"/app/openolt",
"--kafka_adapter_address=${DOCKER_HOST_IP}:9092",
"--kafka_cluster_address=${DOCKER_HOST_IP}:9092",
"--core_topic=rwcore",
"--kv_store_address=${DOCKER_HOST_IP}:2379",
"--log_level=DEBUG"
]
ports:
- "50062:50062"
networks:
- default
restart: unless-stopped
adapter_openonu:
image: "voltha/voltha-openonu-adapter:2.5.0"
command: [
"/voltha/adapters/brcm_openomci_onu/main.py",
"--name=brcm_openomci_onu",
"--kafka_adapter=${DOCKER_HOST_IP}:9092",
"--kafka_cluster=${DOCKER_HOST_IP}:9092",
"--backend=etcd",
"--etcd=${DOCKER_HOST_IP}:2379",
"--core_topic=rwcore",
"--log_level=DEBUG"
]
networks:
- default
restart: unless-stopped
bbsim:
image: "voltha/bbsim:1.1.3"
privileged: true
command: [
"./bbsim",
"-logLevel",
"debug",
"-authRetry",
"-dhcpRetry",
"-pon",
"1",
"-onu",
"1"
]
ports:
- "50060:50060"
- "50074:50074"
networks:
- default
restart: unless-stopped
radius:
image: "tpdock/freeradius:2.2.9"
environment:
RADIUS_LISTEN_IP: "*"
USERS_FILE: "/etc/raddb/users"
RADIUS_CLIENTS: "SECRET@0.0.0.0/0"
volumes:
- "./radius-clients.conf:/etc/raddb/clients.conf"
- "./radius-users.conf:/etc/raddb/users"
ports:
- "1812:1812/udp"
- "1813:1813"
- "18120:18120"
networks:
- default
restart: unless-stopped
起動方法
export DOCKER_HOST_IP=172.17.0.1
docker-compose -f system-test-bbsim.yml up -t 100 -d
停止方法
docker-compose -f system-test-bbsim.yml down
VOLTHAを制御するためのツールであるvoltctlをインストールします。
git clone https://github.com/opencord/voltctl.git
cd voltctl
make build
make install
mkdir ~/.volt/
cat << EOF > ~/.volt/config
apiVersion: v2
server: localhost:50057
tls:
useTls: false
caCert: ""
cert: ""
key: ""
verify: ""
grpc:
timeout: 10s
EOF
cat << EOF > ~/.volt/command_options
device-list:
order: -Root,SerialNumber
device-ports:
order: PortNo
device-flows:
order: Priority,EthType
logical-device-list:
order: RootDeviceId,DataPathId
logical-device-ports:
order: Id
logical-device-flows:
order: Priority,EthType
adapter-list:
order: Id
component-list:
order: Component,Name,Id
loglevel-get:
order: ComponentName,PackageName,Level
loglevel-list:
order: ComponentName,PackageName,Level
EOF
停止方法
DEPLOY_K8S=y ./voltha down
kubernetes構成の環境構築
VOLTHA2.5をインストールする場合の例
git clone https://github.com/opencord/kind-voltha.git
cd kind-voltha/
source releases/voltha-2.5
DEPLOY_K8S=y WITH_BBSIM=y WITH_RADIUS=y CONFIG_SADIS=y ./voltha up
./voltha up
のオプションは持たせたい機能によって変更します。)
ビルド完了後に3つのパスを手動でexportすることを求められるので、ターミナルにコピペをします。
動作の試し方
アダプタ一覧の見方
$ voltctl adapter list
ID VENDOR TYPE ENDPOINT VERSION CURRENTREPLICA TOTALREPLICAS LASTCOMMUNICATION
brcm_openomci_onu_1 VOLTHA OpenONU brcm_openomci_onu brcm_openomci_onu_1 2.5.0 1 1 1m3s
openolt_1 VOLTHA OpenOLT openolt openolt 2.5.6 1 1
デバイス一覧の見方(最初は何も接続されていません。)
$ voltctl device list
ID TYPE ROOT PARENTID SERIALNUMBER ADMINSTATE OPERSTATUS CONNECTSTATUS REASON
シミュレータ BBSIM OLT追加・有効化
voltctl device create -t openolt -H 172.17.0.1:50060
voltctl device enable $(voltctl device list --filter Type~openolt -q)
デバイス一覧表示 (OLTが有効化され、同時にONUが自動検出・有効化されます。)
$ voltctl device list
ID TYPE ROOT PARENTID SERIALNUMBER ADMINSTATE OPERSTATUS CONNECTSTATUS REASON
c9f67829-ee7c-43be-8143-e16f18c32b4b openolt true 6664ad07-d6e2-44a0-ad0a-7b8a1d1c5202 BBSIM_OLT_0 ENABLED ACTIVE REACHABLE
e2faf955-4514-4cd1-9c2a-571a33da2baa brcm_openomci_onu false c9f67829-ee7c-43be-8143-e16f18c32b4b BBSM00000001 ENABLED ACTIVE REACHABLE omci-flows-pushed
Kafkaに警報が保持されていますが、そのTopicの一覧の表示。
$ kafkacat -b localhost:9092 -L
Metadata for all topics (from broker -1: localhost:9092/bootstrap):
1 brokers:
broker 1001 at 172.17.0.1:9092 (controller)
14 topics:
topic "onos.dhcp.stats.kpis" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "rwcore" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "radiusOperationalStatus.events" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "voltha.events" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "_liveness_test" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "adapters.heartbeat" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "__consumer_offsets" with 50 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
partition 1, leader 1001, replicas: 1001, isrs: 1001
partition 2, leader 1001, replicas: 1001, isrs: 1001
partition 3, leader 1001, replicas: 1001, isrs: 1001
partition 4, leader 1001, replicas: 1001, isrs: 1001
partition 5, leader 1001, replicas: 1001, isrs: 1001
partition 6, leader 1001, replicas: 1001, isrs: 1001
partition 7, leader 1001, replicas: 1001, isrs: 1001
partition 8, leader 1001, replicas: 1001, isrs: 1001
partition 9, leader 1001, replicas: 1001, isrs: 1001
partition 10, leader 1001, replicas: 1001, isrs: 1001
partition 11, leader 1001, replicas: 1001, isrs: 1001
partition 12, leader 1001, replicas: 1001, isrs: 1001
partition 13, leader 1001, replicas: 1001, isrs: 1001
partition 14, leader 1001, replicas: 1001, isrs: 1001
partition 15, leader 1001, replicas: 1001, isrs: 1001
partition 16, leader 1001, replicas: 1001, isrs: 1001
partition 17, leader 1001, replicas: 1001, isrs: 1001
partition 18, leader 1001, replicas: 1001, isrs: 1001
partition 19, leader 1001, replicas: 1001, isrs: 1001
partition 20, leader 1001, replicas: 1001, isrs: 1001
partition 21, leader 1001, replicas: 1001, isrs: 1001
partition 22, leader 1001, replicas: 1001, isrs: 1001
partition 23, leader 1001, replicas: 1001, isrs: 1001
partition 24, leader 1001, replicas: 1001, isrs: 1001
partition 25, leader 1001, replicas: 1001, isrs: 1001
partition 26, leader 1001, replicas: 1001, isrs: 1001
partition 27, leader 1001, replicas: 1001, isrs: 1001
partition 28, leader 1001, replicas: 1001, isrs: 1001
partition 29, leader 1001, replicas: 1001, isrs: 1001
partition 30, leader 1001, replicas: 1001, isrs: 1001
partition 31, leader 1001, replicas: 1001, isrs: 1001
partition 32, leader 1001, replicas: 1001, isrs: 1001
partition 33, leader 1001, replicas: 1001, isrs: 1001
partition 34, leader 1001, replicas: 1001, isrs: 1001
partition 35, leader 1001, replicas: 1001, isrs: 1001
partition 36, leader 1001, replicas: 1001, isrs: 1001
partition 37, leader 1001, replicas: 1001, isrs: 1001
partition 38, leader 1001, replicas: 1001, isrs: 1001
partition 39, leader 1001, replicas: 1001, isrs: 1001
partition 40, leader 1001, replicas: 1001, isrs: 1001
partition 41, leader 1001, replicas: 1001, isrs: 1001
partition 42, leader 1001, replicas: 1001, isrs: 1001
partition 43, leader 1001, replicas: 1001, isrs: 1001
partition 44, leader 1001, replicas: 1001, isrs: 1001
partition 45, leader 1001, replicas: 1001, isrs: 1001
partition 46, leader 1001, replicas: 1001, isrs: 1001
partition 47, leader 1001, replicas: 1001, isrs: 1001
partition 48, leader 1001, replicas: 1001, isrs: 1001
partition 49, leader 1001, replicas: 1001, isrs: 1001
topic "authentication.events" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "mcastOperationalStatus.events" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "onos.igmp.stats.kpis" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "brcm_openomci_onu_1" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "onos.aaa.stats.kpis" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "openolt" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
topic "onu.events" with 1 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
onu.events
の表示 (ONUが有効化されたときに発行されます。)
$ kafkacat -b localhost:9092 -t onu.events
% Auto-selecting Consumer mode (use -P or -C to override)
{"timestamp":"2021-01-02T07:59:17.549080Z","status":"activated","serialNumber":"BBSM00000001-1","portNumber":"16","deviceId":"of:00000a0a0a0a0a00","oltSerialNumber":"BBSIM_OLT_0"}
{"timestamp":"2021-01-02T07:59:17.675338Z","status":"activated","serialNumber":"BBSM00000001-2","portNumber":"17","deviceId":"of:00000a0a0a0a0a00","oltSerialNumber":"BBSIM_OLT_0"}
{"timestamp":"2021-01-02T07:59:17.676056Z","status":"activated","serialNumber":"BBSM00000001-3","portNumber":"18","deviceId":"of:00000a0a0a0a0a00","oltSerialNumber":"BBSIM_OLT_0"}
{"timestamp":"2021-01-02T07:59:17.676742Z","status":"activated","serialNumber":"BBSM00000001-4","portNumber":"19","deviceId":"of:00000a0a0a0a0a00","oltSerialNumber":"BBSIM_OLT_0"}
{"timestamp":"2021-01-02T07:59:17.677510Z","status":"activated","serialNumber":"BBSM00000001-1","portNumber":"16","deviceId":"of:00000a0a0a0a0a00","oltSerialNumber":"BBSIM_OLT_0"}
authentication.events
の表示 (ONU認証の開始、完了時に発行されます。)
$ kafkacat -b localhost:9092 -t authentication.events
% Auto-selecting Consumer mode (use -P or -C to override)
{"timestamp":"2021-01-02T07:59:23.790498Z","deviceId":"of:00000a0a0a0a0a00","portNumber":"16","serialNumber":"BBSM00000001-1","authenticationState":"STARTED"}
{"timestamp":"2021-01-02T07:59:23.911633Z","deviceId":"of:00000a0a0a0a0a00","portNumber":"16","serialNumber":"BBSM00000001-1","authenticationState":"REQUESTED"}
{"timestamp":"2021-01-02T07:59:23.911870Z","deviceId":"of:00000a0a0a0a0a00","portNumber":"16","serialNumber":"BBSM00000001-1","authenticationState":"APPROVED"}
ONOSへの入り方
ssh -p 8101 karaf@localhost
(password: karaf)
認識されているポート情報を確認する。
karaf@root > ports 08:10:09
id=of:00000a0a0a0a0a00, available=true, local-status=connected 11m3s ago, role=MASTER, type=SWITCH, mfr=VOLTHA Project, hw=open_pon, sw=open_pon, serial=BBSIM_OLT_0, chassis=a0a0a0a0a00, driver=voltha, channelId=172.19.0.1:36746, managementAddress=172.19.0.1, protocol=OF_13
port=16, state=enabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:10, portName=BBSM00000001-1
port=17, state=disabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:11, portName=BBSM00000001-2
port=18, state=disabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:12, portName=BBSM00000001-3
port=19, state=disabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:13, portName=BBSM00000001-4
port=1048576, state=enabled, type=fiber, speed=0 , adminState=enabled, portMac=0a:0a:0a:0a:0a:00, portName=nni-1048576
加入者設定(帯域設定、VLAN設定)を行う。
karaf@root > volt-add-subscriber-access of:00000a0a0a0a0a00 16
加入者設定の投入状態を確認する。
karaf@root > volt-programmed-subscribers 08:13:38
location=of:00000a0a0a0a0a00/16 tagInformation=UniTagInformation{uniTagMatch=0, ponCTag=900, ponSTag=900, usPonCTagPriority=-1, usPonSTagPriority=-1, dsPonCTagPriority=-1, dsPonSTagPriority=-1, technologyProfileId=64, enableMacLearning=false, upstreamBandwidthProfile='Default', downstreamBandwidthProfile='Default', serviceName='', configuredMacAddress='A4:23:05:00:00:00', isDhcpRequired=true, isIgmpRequired=false}
ONOSのGUIツールをインストールする。
karaf@root > feature:install onos-web-gui
ブラウザでhttp://localhost:8181/onos/ui
にアクセスする(User: karaf, Pass: karaf)。Devicesタブでスイッチが1つ表示されるのを確認できる。