OSM MAAS Plugin
OSM MAAS Plugin
Setup development server
Step 1: Install OSM
VM requirement to install OSM
- MINIMUM: 2 CPUs, 6 GB RAM, 40GB disk and a single interface with Internet access
- RECOMMENDED: 2 CPUs, 8 GB RAM, 40GB disk and a single interface with Internet access
- Base image: Ubuntu18.04 (64-bit variant required)
note: I have installed VM on a KVM host in the Ubuntu machine.
Download and run the OSM installation script
<source lang="bash">wget https://osm-download.etsi.org/ftp/osm-10.0-ten/install_osm.sh chmod +x install_osm.sh
./install_osm.sh</source>
Step 2
Install dependency
<source lang="bash">DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ DEBIAN_FRONTEND=noninteractive apt-get --yes install \ gcc python3 python3-dev python3-venv python3-pip \ python3-setuptools curl git genisoimage netbase</source>
<source lang="bash">python3 -m pip install -U pip build</source>clone RO, and Common
<source lang="bash">git clone https://osm.etsi.org/gerrit/osm/common.git
git clone https://osm.etsi.org/gerrit/osm/RO</source>Install dependency
<source lang="bash">python3 -m pip install -r RO/requirements.txt python3 -m pip install -r common/requirements.txt python3 -m pip install -e common # try with --user if get permission errors python3 -m pip install -e ./RO/NG-RO
python3 -m pip install -e ./RO/RO-plugin</source>Start RO server (It need to connect to database server we expose in next step)
<source lang="bash">python3 RO/NG-RO/osm_ng_ro/ro_main.py</source>
Step 3
create k8s yaml file with these to expose the service port (expose_service.yaml)
<source lang="bash">---
- kafka
apiVersion: v1 kind: Service metadata:
name: kafka-debug namespace: osm
spec:
externalTrafficPolicy: Cluster ports: - nodePort: 9092 port: 9092 protocol: TCP targetPort: 9092 selector: app: kafka sessionAffinity: None type: NodePort
status:
loadBalancer: {}
---
- mysql
apiVersion: v1 kind: Service metadata:
name: mysql-debug namespace: osm
spec:
externalTrafficPolicy: Cluster ports: - nodePort: 3306 port: 3306 protocol: TCP targetPort: 3306 selector: app: mysql sessionAffinity: None type: NodePort
status:
loadBalancer: {}
---
- mongo
apiVersion: v1 kind: Service metadata:
name: mongo-debug namespace: osm
spec:
externalTrafficPolicy: Cluster ports: - nodePort: 27017 port: 27017 protocol: TCP targetPort: 27017 selector: app: mongo sessionAffinity: None type: NodePort
status:
loadBalancer: {}
</source>apply service
<source lang="bash">kubectl apply -n osm -f expose_service.yaml</source>Edit /etc/hosts file to add host name with the following value
<source lang="bash">127.0.0.1 localhost kafka kafka-0.kafka.osm.svc.cluster.local keystone nbi mongo mysql ro</source>Remove RO from k8s
<source lang="bash">kubectl -n osm scale deployment ro --replicas=0
kubectl -n osm delete service/ro</source>Update LCM to point to new RO server
<source lang="bash">kubectl -n osm patch deployment lcm --patch '{"spec": {"template": {"spec": {"containers": [{"name": "lcm", "env": [{"name": "OSMLCM_RO_HOST", "value": "172.17.0.1"}] }]}}}}'</source>
noted: if the patch deployment fail, we can update the /etc/hosts file in the container
<source lang="bash">kubectl -n osm exec -i -t lcm-69d8d4fb5c-l7mtl -- /bin/bash nano /etc/hosts
172.17.0.1 ro</source>Read DB common key
<source lang="bash">kubectl get secret lcm-secret -n osm --template=Template:.data.OSMLCM DATABASE COMMONKEY | base64 --decode</source>Update ro.cfg file to use the common and static dir, (Note: I need to run ‘kubectl get service -n osm’ to get the mongo-db-k8s service cluster IP address and put it in the cfg file, so I am not sure if edit hosts file and expose ports steps are necessary)
<source lang="bash">[database]
- use env OSMRO_DATABASE_XXX to override
driver: "mongo" # mongo or memory uri: "mongodb://mongo:27017" name: "osm"
- user: "user"
- password: "password"
Start RO server (continue from step 1)
<source lang="bash">python3 RO/NG-RO/osm_ng_ro/ro_main.py</source>
note: if we get error msg about static directory, or mongo connection. we need to update ro.cfg file (change mongo to cluster ip and restart the server).
Step 4
Create a ro_vim_maas module by copying from one of the vim. (Or clone our git repo.)
<source lang="bash">cp -r RO/RO-VIM-aws ./RO-VIM-maas</source>Edit setup.py, requirement, vimconn_xxx.py file to change vim name, etc.
Run the module in development mode
<source lang="bash">python3 -m pip install -e ./RO-VIM-maas</source>Restart RO server