Access OpenStack Dashboard on CORD

在 CORD 當中,所有 Service instance 都是透過 XOS 呼叫 OpenStack 去得到一臺 VM,而這臺 VM 的規格也是我們自己指定的 Flavor,在此篇將簡單介紹 CORD 當中如何去存取 OpenStack Dashboard(Horizon)與 Instance。

在 CORD 官方指南是很值得參考的資源:

而下圖是出自於 2017 ONOS/CORD Taiwan Workshop 的 CORD 架構圖:

CORD-in-a-box Architecture

前情提要

這一篇 Blog 目的想要記錄當 CORD Service Deploy 上去並建立一個 Instance,卻因為網路不明原因而失敗,所以才開始研究 Openstack Neutron 與 CORD 之間的運作機制。

首先需要先知道我們有三台 Vagrant VM:

1
2
3
4
5
6
[email protected]:~# virsh list
Id Name State
----------------------------------------------------
25 build_prod running
26 build_corddev running
29 build_compute_node-1 running

這三台分別有著不同的功能:

  • prod:OpenStackONOSXOS 都跑在這臺 VM 的 Docker Container 當中。
  • compute_node:被 OpenStack 所控制的機器,且只能被 prod access。
  • corddev:在安裝 CiaB 時,會把所有 Docker Container 放在這裡 Build,像是 OpenStackONOSXOS 都是在此做的。


prod 主機當中的 docker

這裡面的 Docker Container 包含了 XOSONOS 相關的 Container,例如我們存取的 M-CORD Admin Page 就是 xos-ui 這個 Container 負責的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[email protected]:~/service-profile/mcord$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aa80bc279f22 xosproject/xos-ui "python /opt/xos/mana" 2 hours ago Up 2 hours 0.0.0.0:8888->8888/tcp mcord_xos_ui_1
eaabda841ae0 xosproject/xos-synchronizer-openstack "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_openstack_1
dd8b9584c2ac xosproject/xos-synchronizer-vmme "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_vmme_1
f322def18da3 xosproject/xos-synchronizer-oai "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_oai_1
503fb6de928d xosproject/xos-synchronizer-vbbu "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_vbbu_1
90952e8df73b xosproject/xos-synchronizer-onos "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_onos_1
1ccea3102966 xosproject/xos-synchronizer-vsgw "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_vsgw_1
87b9c18e8c0d xosproject/xos-synchronizer-vtn "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_vtn_1
1f570fc2569b xosproject/xos-synchronizer-vpgwc "bash -c 'sleep 120; " 2 hours ago Up 2 hours mcord_xos_synchronizer_vpgwc_1
215b04d14a1a xosproject/xos "python /opt/xos/mana" 2 hours ago Up 2 hours 0.0.0.0:81->81/tcp mcordbs_xos_bootstrap_ui_1
29240520de47 xosproject/xos "bash -c 'cd /opt/xos" 2 hours ago Up 2 hours mcordbs_xos_synchronizer_onboarding_1
1f9ea3d9b2d0 redis "docker-entrypoint.sh" 2 hours ago Up 2 hours 6379/tcp mcordbs_xos_redis_1
f473cb734f3b xosproject/xos-postgres "/usr/lib/postgresql/" 2 hours ago Up 2 hours 5432/tcp mcordbs_xos_db_1
733d0f25ff46 docker-registry:5000/opencord/onos:candidate "./bin/onos-service" 2 days ago Up 2 days 0.0.0.0:2620->2620/tcp, 0.0.0.0:6653->6653/tcp, 0.0.0.0:8101->8101/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:9876->9876/tcp onosfabric_xos-onos_1
05267f093f5b xos/onos "./bin/onos-service" 2 days ago Up 2 days 0.0.0.0:6654->6653/tcp, 0.0.0.0:8102->8101/tcp, 0.0.0.0:8182->8181/tcp, 0.0.0.0:9877->9876/tcp onoscord_xos-onos_1
88498aa57faf docker-registry:5000/mavenrepo:candidate "nginx -g 'daemon off" 2 days ago Up 2 days 0.0.0.0:8080->80/tcp mavenrepo
bfa85c3a6abb docker-registry:5000/cord-maas-automation:candidate "/go/bin/cord-maas-au" 2 days ago Up 2 days automation
e7d33eac6df7 docker-registry:5000/cord-maas-switchq:candidate "/go/bin/switchq" 2 days ago Up 2 days 0.0.0.0:4244->4244/tcp switchq
657f03645a9f docker-registry:5000/cord-provisioner:candidate "/go/bin/cord-provisi" 2 days ago Up 2 days 0.0.0.0:4243->4243/tcp provisioner
22f8ffe60d02 docker-registry:5000/config-generator:candidate "/go/bin/config-gener" 2 days ago Up 2 days 1337/tcp, 0.0.0.0:4245->4245/tcp generator
ffe76dcd9bdf docker-registry:5000/cord-ip-allocator:candidate "/go/bin/cord-ip-allo" 2 days ago Up 2 days 0.0.0.0:4242->4242/tcp allocator
cb0f9b281755 docker-registry:5000/consul:candidate "docker-entrypoint.sh" 2 days ago Up 2 days storage
f4382ec9f142 docker-registry:5000/cord-dhcp-harvester:candidate "/go/bin/harvester" 2 days ago Up 2 days 0.0.0.0:8954->8954/tcp harvester
16275344effd registry:2.4.0 "/bin/registry serve " 2 days ago Up 2 days 0.0.0.0:5000->5000/tcp registry
9a83e8073b2a registry:2.4.0 "/bin/registry serve " 2 days ago Up 2 days 0.0.0.0:5001->5000/tcp registry-mirror


prod 主機當中的 lxd container

在這個列表當中,以 -1 結尾的 lxc,代表是 OpenStack 的元件,而若你有出現 testclient,這個 lxc 代表安裝 CORD in a Box 時的測試 Client,為了確定網路有接通。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[email protected]:~/service-profile/mcord$ sudo lxc list
+-------------------------+---------+------------------+------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+-------------------------+---------+------------------+------+------------+-----------+
| ceilometer-1 | RUNNING | 10.1.0.4 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| glance-1 | RUNNING | 10.1.0.5 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| juju-1 | RUNNING | 10.1.0.3 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| keystone-1 | RUNNING | 10.1.0.6 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| mongodb-1 | RUNNING | 10.1.0.13 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| nagios-1 | RUNNING | 10.1.0.8 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| neutron-api-1 | RUNNING | 10.1.0.9 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| nova-cloud-controller-1 | RUNNING | 10.1.0.10 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| openstack-dashboard-1 | RUNNING | 10.1.0.11 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| percona-cluster-1 | RUNNING | 10.1.0.7 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+
| rabbitmq-server-1 | RUNNING | 10.1.0.12 (eth0) | | PERSISTENT | 0 |
+-------------------------+---------+------------------+------+------------+-----------+

特別標示出來的這一行 openstack-dashboard-1 是我們這次的目標。


透過 ssh tunnel 打通 OpenStack DashBoard

因為這個 Dashboard 位於 prod 上,因此我們可以使用以下指令來建立 SSH Tunnel:

1
ssh -L 0.0.0.0:9999:10.1.0.11:80 prod

這個指令會將安裝 CORD in a Box 的機器 Listen 在所有 Interface 的 9999 Port,並建 Tunnel 到 prod 主機的 10.1.0.11,也就是 Horizon 所在的機器的 80 Port。

接下來你就可以連線到:https://<ciab-ip-address>:9999/horizon 存取 OpenStack Horizon 了。

至於它的預設密碼,你能夠於 ~/service-profile/mcord/admin-openrc.sh 找到,admin-openrc.sh 同時也是我們要使用 nova 指令來控制 OpenStack 時需要的檔案。

在 OpenStack 上可以看到透過 XOS 所建立的 Instance:

OpenStack Dashboard

常用到的指令

畢竟 CLI 的可控程度遠高於 GUI,因此在這也記錄一下常用到的指令,請記得要 source ./admin-openrc.sh 就是了:

列出所有 Tenant

1
nova list --all-tenants

列出所有 Network

1
neutron net-list

列出所有 Port

1
neutron port-list

刪除某個 Network

1
neutron net-delete <network-id>

刪除某個 Port

1
neutron port-delete <port-id>