Play with OSM (by quqi99)

osm 专栏收录该内容
1 篇文章 0 订阅

作者:张华 发表于:2020-05-08
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

对OSM的一般印象

各种社区推动着NFV和SDN技术背后软件堆栈的创新,如OpenStack、ONAP、ETSI Open Source MANO(OSM)、OPNFV、OpenDaylight、Open Networking Foundation(ONF)、Open Contrail、Open Baron、On.Lab、 CORD、Kubernetes、ONOS和Open-O。其中OpenStack与OSM是部署NFV的两大支柱.

  • 各种OpenStack项目(包括Tacker、Neutron、Nova、Astara、Congress、Mistral和Senlin)能够管理NFV环境的虚拟化基础设施组件。例如,Tacker用于构建通用VNF管理器(VNFM)和NFV Orchestrator(NFVO),这有助于在NFV基础设施内部署和运维VNF。此外,集成OpenStack项目为NFV基础设施引入了各种功能,包括大页面、CPU Pinning、NUMA拓扑和SR-IOV等性能功能以及服务功能链、网络切片、可扩展性、高可用性、弹性和多站点支持。用OpenStack实施NFV环境的电信服务提供商和企业包括AT&T、中国移动、SK电信、爱立信、德国电信、康卡斯特和彭博。类似于OpenStack官方
  • Tacker(https://blog.csdn.net/quqi99/article/details/78473137)可以编排VIM与VNF, Open Source MANO(OSM,OPNFV和ONAP都同属于Linux基金会, ETSI ISG NFV和OSM都属于ETSI,在ETSI ISG NFV中活跃的成员包括:NTT Docomo,KDDI,KT,中国联通,德国电信,Telefonica,意大利电信,BT,Orange,AT&T,Verizon,Bell Canada和Rogers。其中也有很多成员积极参与OPNFV和ONAP。)也可以做类似的事,前者Tacker基于TOSCA VNFD语法,后者OSM则一般采用ssh的方式编排VIM与VNF)

OSM的一般用法见: https://osm.etsi.org/docs/user-guide/01-quickstart.html, 和Tacker也类似:

  • 首先需要部署OSM自身的服务(lcm, mon, nbi, pol, ro, keystone, kafka, mongo, mysql, zookeeper, prometheus etc) OSM官方默认将OSM服务部署在Docker Swarm中,也可以部署在k8s集群中, Ubuntu有对应的charm来部署这些OSM自身的服务(A minimal charmed OSM : https://jaas.ai/osm/bundle, HA charmed OSM - https://jaas.ai/osm-ha/bundle),既然有charm,当然通过juju就可以将这些服务部署到裸机,虚机,lxd,k8s上,这里也描述了如何将OSM部署到microk8s上(https://jaas.ai/osm/bundle
  • 在OSM配置访问VIM(eg: OpenStack, VMWare vCloud Direcor, AWS, Azure)的帐号, eg: osm vim-create --name openstack-site --user admin --password userpwd --auth_url http://10.10.10.11:5000/v2.0 --tenant admin --account_type openstack
  • 部署VNF, 官网中是以cirros_vnf为例的 如果使用了charmed osm, vnf是通过proxy
    charm写的,例子见:https://blog.csdn.net/quqi99/article/details/103175749
    在这里插入图片描述
    在这里插入图片描述

实验 - MicroK8s + MicroStack + Charmed OSM

Ubuntu 18.04 LTS Operating System,
16 GB of RAM,
4 CPUs,
50 GB of free storage space.

#Before you start
sudo snap install juju --classic
sudo snap install osmclient --beta
sudo snap connect osmclient:juju-client-observe
sudo snap connect osmclient:ssh-public-keys 
sudo snap connect osmclient:network-control
juju bootstrap localhost osm-lxd

#Setting up MicroK8s
sudo snap install microk8s --classic
sudo usermod -a -G microk8s $USER 
newgrp microk8s
microk8s.status --wait-ready
microk8s.enable storage dns
microk8s.kubectl cluster-info

#Setting up MicroStack
sudo snap install microstack --classic --beta
sudo microstack.init --auto
wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
microstack.openstack image create --public --disk-format qcow2 --container-format bare --file ubuntu-16.04-server-cloudimg-amd64-disk1.img ubuntu1604
microstack.openstack server list

#Setting up Charmed OSM
juju bootstrap microk8s osm-k8s
juju add-model osm
osmclient.overlay
juju deploy osm --overlay vca-overlay.yaml
juju status
export OSM_HOSTNAME=`juju status nbi-k8s | grep kubernetes | awk '{print $8}'`
echo "export OSM_HOSTNAME=$OSM_HOSTNAME" >> ~/.bashrc
osmclient.osm ns-list

#Add MicroStack as a VIM
osmclient.osm vim-create --name microstack \
      --user admin \
      --password keystone \
      --auth_url http://10.20.20.1:5000/v3 \
      --tenant admin \
      --account_type openstack \
      --config='{security_groups: default,
                 keypair: microstack,
                 project_name: admin,
                 user_domain_name: default,
                 region_name: microstack,
                 insecure: True,
                 availability_zone: nova,
                 version: 3,
                 use_floating_ip: true}'

#Onboarding VNFs
wget http://bit.ly/basic_vnfd -O hackfest_basic_vnf.tar.gz
wget http://bit.ly/basic_nsd -O hackfest_basic_ns.tar.gz
osmclient.osm upload-package hackfest_basic_vnf.tar.gz
osmclient.osm upload-package hackfest_basic_ns.tar.gz
osmclient.osm nsd-list
osmclient.osm vnfd-list
osmclient.osm ns-create --ns_name hackfest_basic_ns --nsd_name hackfest_basic-ns --vim_account microstack --config '{vld: [ { name: mgmtnet, vim-network-name: test } ] }'
osmclient.osm ns-list
IP=`microstack.openstack server list -c Networks -f value --name basic | awk '{ print $2 }'`
ssh ubuntu@$IP -i .ssh/id_microstack

#Enable/Disable the Development Stack
#microk8s.disable dns
#sudo snap disable microstack
#sudo snap disable microk8s
sudo snap enable microstack; sleep 60
sudo snap enable microk8s
microk8s.status --wait-ready
microk8s.enable dns
microstack.openstack server list

#use multipass in win10 - https://multipass.run/#install
#enable hyper-v server and start hypver-v services
multipass find
multipass launch --name ubuntu  #note: need to kill wall
multipass exec ubuntu -- lsb_release -a
multipass list

实验 - k8s + openstack + Charmed OSM

上面的实验是基于MicroK8s + MicroStack + Charmed OSM的, 全是LXD容器的, 可以运行在单机上, 但是资源不够时容易出错.
现在的这种实验是先将一个openstack环境注册为juju cloud(stsstack), 然后再其上部署k8s cluster(k8s model in cloud stsstack) , 接着再将这个k8s cluster注册为juju cloud(myk8scloud),
然后在myk8scloud上部署Charmed OSM, 最后Charmed OSM再将底层的openstack作为vim管理. 部署步骤:

cd ~/xxx-bundles/
cd ./kubernetes
./generate-bundle.sh -s bionic --create-model --name k8s --run
cd ./osm
#Added 'osm' model on myk8scloud/default with credential 'myk8scloud' for user 'admin'
./generate-bundle.sh --name osm:myk8scloud --k8s-model k8s  --create-model 
juju show-cloud myk8scloud
#juju destroy-model osm --destroy-storage -y
#openstack volume list |grep pvc |awk '{print $2}' |xargs -i openstack volume delete {}
juju deploy ./b/osm/osm.yaml --channel=stable #it needs 22 volues at least, so be careful your quota

ubuntu@zhhuabj-bastion:~/stsstack-bundles/osm$ juju status |grep nbi-k8s
nbi-k8s         nbi:7                           active      1  nbi-k8s         jujucharms   38  kubernetes  10.152.183.96   
nbi-k8s/0*         active    idle   10.1.88.44  9999/TCP                    ready

ubuntu@zhhuabj-bastion:~/stsstack-bundles/osm$ kubectl -n osm get svc |grep 'nbi-k8s '
nbi-k8s                    NodePort    10.152.183.96    <none>        9999:30585/TCP               66m

ubuntu@zhhuabj-bastion:~/stsstack-bundles/osm$ juju status kubernetes-worker/0 |grep started
4        started  10.0.0.26  932b2c48-2f75-411b-94c1-32d4e102a9f8  bionic  nova  ACTIVE

ubuntu@zhhuabj-bastion:~/stsstack-bundles/osm$ openstack port list |grep 10.0.0.26
| 5f4a0c8f-d786-4143-b72c-c85b933559c3 |                      | fa:16:3e:18:b0:44 | ip_address='10.0.0.26', subnet_id='027cc592-fdc4-4a61-bfee-b4430e924841'    | ACTIVE |

ubuntu@zhhuabj-bastion:~/stsstack-bundles/osm$ openstack port show 5f4a0c8f-d786-4143-b72c-c85b933559c3 |grep security_group_ids
| security_group_ids      | 415241ed-6b97-4543-8b62-e1b38610dc7b, 662913c6-1179-4cdb-b814-4cb854b6382d 

ubuntu@zhhuabj-bastion:~/stsstack-bundles/osm$ openstack port show 5f4a0c8f-d786-4143-b72c-c85b933559c3 |grep security_group_ids
| security_group_ids      | 415241ed-6b97-4543-8b62-e1b38610dc7b, 662913c6-1179-4cdb-b814-4cb854b6382d


openstack security group rule create 415241ed-6b97-4543-8b62-e1b38610dc7b --protocol tcp --remote-ip 0.0.0.0/0 --dst-port 30585
openstack security group rule create 415241ed-6b97-4543-8b62-e1b38610dc7b --protocol icmp --remote-ip 0.0.0.0/0
telnet 10.152.183.96 30585
export OSM_HOSTNAME=10.0.0.26:30585
osmclient.osm ns-list

一些输出:

$ juju models
Controller: zhhuabj
Model       Cloud/Region        Type        Status     Machines  Cores  Units  Access  Last connection
controller  stsstack/stsstack   openstack   available         1      2  -      admin   just now
default     stsstack/stsstack   openstack   available         0      -  -      admin   4 hours ago
k8s         stsstack/stsstack   openstack   available         7      9  13     admin   2 minutes ago
osm*        myk8scloud/default  kubernetes  available         0      -  12     admin   1 minute ago

buntu@zhhuabj-bastion:~/stsstack-bundles/osm$ kubectl get pods -n osm
NAME                           READY   STATUS    RESTARTS   AGE
grafana-k8s-7fc6d958f9-lk7cx   1/1     Running   0          112m
grafana-k8s-operator-0         1/1     Running   0          113m
kafka-k8s-0                    1/1     Running   0          112m
kafka-k8s-operator-0           1/1     Running   0          113m
lcm-k8s-0                      1/1     Running   0          111m
lcm-k8s-operator-0             1/1     Running   0          113m
mariadb-k8s-0                  1/1     Running   0          112m
mariadb-k8s-operator-0         1/1     Running   0          113m
mon-k8s-0                      1/1     Running   0          111m
mon-k8s-operator-0             1/1     Running   0          113m
mongodb-k8s-0                  1/1     Running   0          112m
mongodb-k8s-operator-0         1/1     Running   0          112m
nbi-k8s-0                      1/1     Running   0          111m
nbi-k8s-operator-0             1/1     Running   0          112m
pol-k8s-0                      1/1     Running   0          111m
pol-k8s-operator-0             1/1     Running   0          112m
prometheus-k8s-0               2/2     Running   0          112m
prometheus-k8s-operator-0      1/1     Running   0          112m
ro-k8s-0                       1/1     Running   0          112m
ro-k8s-operator-0              1/1     Running   0          112m
ui-k8s-85c84c6fbf-6xj7p        1/1     Running   0          111m
ui-k8s-operator-0              1/1     Running   0          112m
zookeeper-k8s-0                1/1     Running   0          112m
zookeeper-k8s-operator-0       1/1     Running   0          112m

ubuntu@zhhuabj-bastion:~/stsstack-bundles/osm$ juju status
Model  Controller  Cloud/Region       Version  SLA          Timestamp
k8s    zhhuabj     stsstack/stsstack  2.7.6    unsupported  09:46:41Z

App                    Version  Status  Scale  Charm                  Store       Rev  OS      Notes
containerd             1.3.3    active      3  containerd             jujucharms   64  ubuntu  
easyrsa                3.0.1    active      1  easyrsa                jujucharms  303  ubuntu  
etcd                   3.2.10   active      1  etcd                   jujucharms  501  ubuntu  
flannel                0.11.0   active      3  flannel                jujucharms  477  ubuntu  
kubeapi-load-balancer  1.14.0   active      1  kubeapi-load-balancer  jujucharms  715  ubuntu  exposed
kubernetes-master      1.18.2   active      1  kubernetes-master      jujucharms  826  ubuntu  exposed
kubernetes-worker      1.18.2   active      2  kubernetes-worker      jujucharms  661  ubuntu  exposed
openstack-integrator   train    active      1  openstack-integrator   jujucharms   59  ubuntu  

Unit                      Workload  Agent  Machine  Public address  Ports           Message
easyrsa/0*                active    idle   0        10.0.0.4                        Certificate Authority connected.
etcd/0*                   active    idle   1        10.0.0.5        2379/tcp        Healthy with 1 known peer
kubeapi-load-balancer/0*  active    idle   2        10.0.0.27       443/tcp         Loadbalancer ready.
kubernetes-master/0*      active    idle   3        10.0.0.10       6443/tcp        Kubernetes master running.
  containerd/2            active    idle            10.0.0.10                       Container runtime available
  flannel/2               active    idle            10.0.0.10                       Flannel subnet 10.1.59.1/24
kubernetes-worker/0       active    idle   4        10.0.0.26       80/tcp,443/tcp  Kubernetes worker running.
  containerd/1            active    idle            10.0.0.26                       Container runtime available
  flannel/1               active    idle            10.0.0.26                       Flannel subnet 10.1.22.1/24
kubernetes-worker/1*      active    idle   5        10.0.0.15       80/tcp,443/tcp  Kubernetes worker running.
  containerd/0*           active    idle            10.0.0.15                       Container runtime available
  flannel/0*              active    idle            10.0.0.15                       Flannel subnet 10.1.88.1/24
openstack-integrator/0*   active    idle   6        10.0.0.23                       Ready

Machine  State    DNS        Inst id                               Series  AZ    Message
0        started  10.0.0.4   ea81504a-0c5a-4899-9840-c71a099cd881  bionic  nova  ACTIVE
1        started  10.0.0.5   cd1bac89-0c93-4b2a-87fe-1ed4df68dac5  bionic  nova  ACTIVE
2        started  10.0.0.27  d1cdc6e1-fee8-44b3-8deb-5037c6eebc13  bionic  nova  ACTIVE
3        started  10.0.0.10  9d2603b0-2833-4011-87e0-9894791181fd  bionic  nova  ACTIVE
4        started  10.0.0.26  932b2c48-2f75-411b-94c1-32d4e102a9f8  bionic  nova  ACTIVE
5        started  10.0.0.15  cf5a2466-f034-481d-9541-8f0c5770c30b  bionic  nova  ACTIVE
6        started  10.0.0.23  653815b1-5b30-418f-a244-3d1a5feb47a4  bionic  nova  ACTIVE

创建vim

# if it needs amdin you can also create a upper openstack over underlying openstack
juju add-model rocky stsstack/stsstack
./generate-bundle.sh --series bionic --release rocky --num-compute 2 --create-model --name rocky:stsstack --run
./configure
./tools/instance_launch.sh 1 cirros  #to create testkey

#Add MicroStack as a VIM
$ env |grep OS_
OS_AUTH_URL=http://10.5.0.5:5000/v3
OS_REGION_NAME=RegionOne
OS_PROJECT_NAME=admin
OS_PROJECT_DOMAIN_NAME=admin_domain
OS_USER_DOMAIN_NAME=admin_domain
OS_IDENTITY_API_VERSION=3
OS_PASSWORD=openstack
OS_USERNAME=admin
osmclient.osm vim-create --wait --name testvim \
      --user admin \
      --password openstack \
      --auth_url http://10.5.0.5:5000/v3 \
      --tenant admin \
      --account_type openstack \
      --config='{security_groups: default,
                 keypair: testkey,
                 project_name: admin,
                 user_domain_name: admin_domain,
                 project_domain_name: admin_domain,
                 region_name: RegionOne,
                 availability_zone: nova,
                 version: 3,
                 use_floating_ip: true}'
osmclient.osm vim-list

Onboarding VNFs

#Onboarding VNFs
wget http://bit.ly/basic_vnfd -O hackfest_basic_vnf.tar.gz
wget http://bit.ly/basic_nsd -O hackfest_basic_ns.tar.gz
#image name is hard codes in hackfest_basic_vnf/hackfest_basic_vnfd.yaml, so change it, then run
tar -czvf hackfest_basic_vnf.tar.gz hackfest_basic_vnf
osmclient.osm upload-package hackfest_basic_vnf.tar.gz
osmclient.osm upload-package hackfest_basic_ns.tar.gz
osmclient.osm nsd-list
osmclient.osm vnfd-list
osmclient.osm ns-create --ns_name hackfest_basic_ns --nsd_name hackfest_basic-ns --vim_account testvim --config '{vld: [ { name: mgmtnet, vim-network-name: private } ] }'
osmclient.osm ns-list
kubectl -n osm logs ro-k8s-0 -f  #this is the place where we can see communication from OSM to openstack
IP=`openstack server list -c Networks -f value --name basic | awk '{ print $2 }'`
ssh ubuntu@$IP -i ~/testkey.priv

some logs:

$ osmclient.osm ns-list
+-------------------+--------------------------------------+---------------------+----------+-------------------+---------------+
| ns instance name  | id                                   | date                | ns state | current operation | error details |
+-------------------+--------------------------------------+---------------------+----------+-------------------+---------------+
| hackfest_basic_ns | f34cb6a7-250c-49f9-9a39-213be63f603c | 2020-05-15T09:31:46 | READY    | IDLE (None)       | N/A           |
+-------------------+--------------------------------------+---------------------+----------+-------------------+---------------+
To get the history of all operations over a NS, run "osm ns-op-list NS_ID"
For more details on the current operation, run "osm ns-op-show OPERATION_ID"

$ nova list |grep hack
| b3696be4-773a-4bc6-8153-1ba06321d470 | hackfest_basic_ns-1-hackfest_basic-VM-1 | ACTIVE | -          | Running     | private=192.168.21.7, 10.5.150.20 |

$ cat hackfest_basic_vnfd.yaml 
vnfd:vnfd-catalog:
    vnfd:
    -   id: hackfest_basic-vnf
        name: hackfest_basic-vnf
        short-name: hackfest_basic-vnf
        version: '1.0'
        description: A basic VNF descriptor w/ one VDU
        logo: osm.png
        connection-point:
        -   name: vnf-cp0
            type: VPORT
        vdu:
        -   id: hackfest_basic-VM
            name: hackfest_basic-VM
            image: bionic
            alternative-images:
            -   vim-type: aws
                image: ubuntu/images/hvm-ssd/ubuntu-artful-17.10-amd64-server-20180509
            count: '1'
            vm-flavor:
                vcpu-count: '1'
                memory-mb: '1024'
                storage-gb: '10'
            interface:
            -   name: vdu-eth0
                type: EXTERNAL
                virtual-interface:
                    type: PARAVIRT
                external-connection-point-ref: vnf-cp0
        mgmt-interface:
            cp: vnf-cp0

$ cat hackfest_basic_nsd.yaml 
nsd:nsd-catalog:
    nsd:
    -   id: hackfest_basic-ns
        name: hackfest_basic-ns
        short-name: hackfest_basic-ns
        description: Simple NS with a single VNF and a single VL
        version: '1.0'
        logo: osm.png
        constituent-vnfd:
        -   vnfd-id-ref: hackfest_basic-vnf
            member-vnf-index: '1'
        vld:
        -   id: mgmtnet
            name: mgmtnet
            short-name: mgmtnet
            type: ELAN
            mgmt-network: 'true'
            vnfd-connection-point-ref:
            -   vnfd-id-ref: hackfest_basic-vnf
                member-vnf-index-ref: '1'
                vnfd-connection-point-ref: vnf-cp0


Reference

[1] https://jaas.ai/tutorials/charmed-osm-get-started

  • 1
    点赞
  • 0
    评论
  • 3
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

参与评论
请先登录 后发表评论~
©️2021 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页

打赏作者

quqi99

你的鼓励就是我创造的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值