1 O-Cloud O2 Service User Guide
2 =============================
4 This guide will introduce the process that make O2 interface work with
7 - Assume you have an O-Cloud O2 environment
11 export OAM_IP=<INF_OAM_IP>
13 - Discover O-Cloud inventory
15 - O-Cloud auto discovery
17 After you installed the O-Cloud service, it will automatically
18 discover the INF through the parameters that you give from the
19 “*o2service-override.yaml*”
21 Below command can get the O-Cloud information
26 "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/" \
27 -H 'accept: application/json'
31 One O-Cloud have one resource pool, all the resources that belong
32 to this O-Cloud will be organized into this resource pool
34 Get the resource pool information through this interface
39 "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/resourcePools" \
40 -H 'accept: application/json'
42 # export resource pool id
43 export resourcePoolId=`curl -X 'GET' "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/resourcePools" -H 'accept: application/json' -H 'X-Fields: resourcePoolId' 2>/dev/null | jq .[].resourcePoolId | xargs echo`
45 echo ${resourcePoolId} # check the exported resource pool id
49 Resource type defined what type is the specified resource, like a
50 physical machine, memory, or CPU
52 Show all resource type
57 "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/resourceTypes" \
58 -H 'accept: application/json'
62 Get the list of all resources, the value of *resourcePoolId* from
63 the result of resource pool interface
68 "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources" \
69 -H 'accept: application/json'
71 Get detail of one resource, need to export one specific resource
72 id that wants to check
77 "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}" \
78 -H 'accept: application/json'
80 - Deployment manager services endpoint
82 The Deployment Manager Service (DMS) that related to this IMS
83 information you can use below API to check
88 "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/deploymentManagers" \
89 -H 'accept: application/json'
91 - Subscribe to the O-Cloud resource change notification
93 Assume you have a SMO, and the SMO have an API can be receive
96 - Create subscription in O-Cloud IMS
101 "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/subscriptions" \
102 -H 'accept: application/json' \
103 -H 'Content-Type: application/json' \
105 "callback": "http://SMO/address/to/callback",
106 "consumerSubscriptionId": "<ConsumerIdHelpSmoToIdentify>",
107 "filter": "<ResourceTypeNameSplitByComma,EmptyToGetAll>"
110 - Handle resource change notification
112 When the SMO callback API get the notification that the resource
113 of O-Cloud changing, use the URL to get the latest resource
114 information to update its database
116 - Orchestrate CNF in helm chart
118 On this sample, we prepare a firewall chart to test the
121 We need to do some preparation to make the helm repo work and include
122 our firewall chart inside of the repository.
124 Get the DMS Id in the O-Cloud, and set it into bash environment
128 curl --location --request GET "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/deploymentManagers"
130 export dmsId=`curl --location --request GET "http://${OAM_IP}:30205/o2ims_infrastructureInventory/v1/deploymentManagers" 2>/dev/null | jq .[].deploymentManagerId | xargs echo`
132 echo ${dmsId} # check the exported DMS id
134 Using helm to deploy a chartmuseum to the INF
138 helm repo add chartmuseum https://chartmuseum.github.io/charts
140 helm pull chartmuseum/chartmuseum # download chartmuseum-3.4.0.tgz to local
141 tar zxvf chartmuseum-3.4.0.tgz
142 cat <<EOF>chartmuseum-override.yaml
151 helm install chartmuseumrepo chartmuseum/chartmuseum -f chartmuseum-override.yaml
155 Update the helm repo and add the chartmusem into the repository
159 helm repo add o2imsrepo http://${NODE_IP}:30330
162 Download the firewall chart and push it into the repository
166 git clone https://github.com/biny993/firewall-host-netdevice.git
167 tar -zcvf firewall-host-netdevice-1.0.0.tgz firewall-host-netdevice/
168 helm plugin install https://github.com/chartmuseum/helm-push.git
169 helm cm-push firewall-host-netdevice-1.0.0.tgz o2imsrepo
171 helm search repo firewall
173 Setup host net device over INF
177 ssh sysadmin@<INF OAM IP>
178 sudo ip link add name veth11 type veth peer name veth12
179 sudo ip link add name veth21 type veth peer name veth22
180 sudo ip link |grep veth
183 - Create NfDeploymentDescriptor
187 curl --location --request POST "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor" \
188 --header 'Content-Type: application/json' \
191 "description": "demo nf deployment descriptor",
192 "artifactRepoUrl": "http://'${NODE_IP}':30330",
193 "artifactName": "firewall-host-netdevice",
195 "{\n \"image\": {\n \"repository\": \"ubuntu\",\n \"tag\": 18.04,\n \"pullPolicy\": \"IfNotPresent\"\n },\n \"resources\": {\n \"cpu\": 2,\n \"memory\": \"2Gi\",\n \"hugepage\": \"0Mi\",\n \"unprotectedNetPortVpg\": \"veth11\",\n \"unprotectedNetPortVfw\": \"veth12\",\n \"unprotectedNetCidr\": \"10.10.1.0/24\",\n \"unprotectedNetGwIp\": \"10.10.1.1\",\n \"protectedNetPortVfw\": \"veth21\",\n \"protectedNetPortVsn\": \"veth22\",\n \"protectedNetCidr\": \"10.10.2.0/24\",\n \"protectedNetGwIp\": \"10.10.2.1\",\n \"vfwPrivateIp0\": \"10.10.1.1\",\n \"vfwPrivateIp1\": \"10.10.2.1\",\n \"vpgPrivateIp0\": \"10.10.1.2\",\n \"vsnPrivateIp0\": \"10.10.2.2\"\n }\n}",
196 "outputParams": "{\"output1\": 100}"
199 curl --location --request GET "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor"
201 export descId=` curl -X 'GET' "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor" -H 'accept: application/json' -H 'X-Fields: id' 2>/dev/null | jq .[].id | xargs echo`
203 echo ${descId} # check the exported descriptor id
205 - Create NfDeployment
207 When you have an descriptor of deployment, you can create a
208 NfDeployment, it will trigger an event inside of the IMS/DMS, and
209 use the K8S API to create a real pod of the firewall sample
213 curl --location --request POST "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" \
214 --header 'Content-Type: application/json' \
217 "description": "demo nf deployment",
218 "descriptorId": "'${descId}'",
219 "parentDeploymentId": ""
222 curl --location --request GET "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment"
224 - Check pods of the firewall sample
230 - Delete the deployment we just created
234 export NfDeploymentId=`curl --location --request GET "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" 2>/dev/null | jq .[].id | xargs echo`
236 echo ${NfDeploymentId} # Check the exported deployment id
238 curl --location --request DELETE "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment/${NfDeploymentId}"