Add osc project profiles on POWDER to source control to make the profiles consistent when releases evolve

Change-Id: I3332d32845fd8139a9cc873eab2be6500a2ffe51
Signed-off-by: pceicicd <pekwatch746@gmail.com>
diff --git a/XTesting/powder-control/README.md b/XTesting/powder-control/README.md
index bdba8fe..2eac7f6 100644
--- a/XTesting/powder-control/README.md
+++ b/XTesting/powder-control/README.md
@@ -76,3 +76,8 @@
 can look at the [Resource Availability](https://www.powderwireless.net/resinfo.php)
 page on the Powder portal to see the status of the required instance. After
 completion, the script will exit with a message about failure/success.
+
+Currently there're a few profiles that are set up for the osc project on POWDER that can be referenced when calling the
+[start-profile.py](start-profile.py) to start with. It's supposed to be a growing list when new profiles
+for certain OSC component(s) setup becomes available and tested on POWDER. To keep it consistent, those
+profiles are checked in under the XTesting/powder-profiles.
diff --git a/XTesting/powder-profiles/Ubuntu-22-AIML b/XTesting/powder-profiles/Ubuntu-22-AIML
new file mode 100644
index 0000000..003f654
--- /dev/null
+++ b/XTesting/powder-profiles/Ubuntu-22-AIML
@@ -0,0 +1,22 @@
+"""Ubuntu 22.04 on a hardware of your choice. This is the base image for the AI/ML framework training host installation"""
+
+import geni.portal as portal
+# Import the ProtoGENI library.
+import geni.rspec.pg as rspec
+
+pc = portal.Context()
+
+pc.defineParameter('hardware_type', 'Hardware type', portal.ParameterType.NODETYPE, '')
+
+params = pc.bindParameters()
+
+request = pc.makeRequestRSpec()
+
+node = request.RawPC('node-0')
+node.hardware_type = params.hardware_type
+node.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU22-64-STD'
+
+# add docker group and manipulate certain ssh key access for root
+node.addService(rspec.Execute(shell="bash", command="sudo groupadd docker && sudo usermod -aG docker root && sudo chown osc_int  -R /root && tail -1 ~/.ssh/authorized_keys >> /root/.ssh/authorized_keys && rm /root/.ssh/id_rsa* && sudo chown root -R /root"))
+
+pc.printRequestRSpec(request)
diff --git a/XTesting/powder-profiles/XTesting-Host b/XTesting/powder-profiles/XTesting-Host
new file mode 100644
index 0000000..787d24f
--- /dev/null
+++ b/XTesting/powder-profiles/XTesting-Host
@@ -0,0 +1,28 @@
+"""Intend to set up a XTesting host on Ubuntu 20.04 on a hardware type of your choice."""
+
+import geni.portal as portal
+# Import the ProtoGENI library.
+import geni.rspec.pg as rspec
+
+pc = portal.Context()
+
+pc.defineParameter('hardware_type', 'Hardware type', portal.ParameterType.NODETYPE, '')
+
+params = pc.bindParameters()
+
+request = pc.makeRequestRSpec()
+
+node = request.RawPC('node-0')
+node.hardware_type = params.hardware_type
+node.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU20-64-STD'
+
+# set up root ssh key access
+node.addService(rspec.Execute(shell="bash", command="sudo chown osc_int  -R /root && tail -1 ~/.ssh/authorized_keys >> /root/.ssh/authorized_keys && rm /root/.ssh/id_rsa* && sudo chown root -R /root"))
+
+# check out code from the it/test repo and install the desired dependencies
+node.addService(rspec.Execute(shell="bash", command="sudo git clone \"https://gerrit.o-ran-sc.org/r/it/test\" /it-test && cd /it-test/XTesting/XTesting-demo && sudo ./install-dependencies.sh 2>&1 | tee /tmp/dep.log"))
+
+# check out code from POWDER example for the rpc, and install the Python dependencies for the POWDER API access
+node.addService(rspec.Execute(shell="bash", command="sudo git clone https://gitlab.flux.utah.edu/powder-profiles/powder-control /powder-control && sudo cp /powder-control/powder/rpc.py /it-test/XTesting/powder-control/powder/rpc.py && cd /it-test/XTesting/powder-control/ && sudo pip3 install -r requirements.txt"))
+
+pc.printRequestRSpec(request)
diff --git a/XTesting/powder-profiles/osc-ricplt b/XTesting/powder-profiles/osc-ricplt
new file mode 100644
index 0000000..59b849f
--- /dev/null
+++ b/XTesting/powder-profiles/osc-ricplt
@@ -0,0 +1,27 @@
+"""Install the latest OSC RIC platform with Ubuntu 20.04 on a hardware type of your choice."""
+
+import geni.portal as portal
+# Import the ProtoGENI library.
+import geni.rspec.pg as rspec
+
+pc = portal.Context()
+
+pc.defineParameter('hardware_type', 'Hardware type', portal.ParameterType.NODETYPE, '')
+
+params = pc.bindParameters()
+
+request = pc.makeRequestRSpec()
+
+node = request.RawPC('node-0')
+node.hardware_type = params.hardware_type
+node.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU20-64-STD'
+
+node.addService(rspec.Execute(shell="bash", command="sudo git clone \"https://gerrit.o-ran-sc.org/r/ric-plt/ric-dep\" /ric-plt"))
+node.addService(rspec.Execute(shell="bash", command="cd /ric-plt/bin && sudo cat install_k8s_and_helm.sh | sed -e '341d' > /tmp/12"))
+node.addService(rspec.Execute(shell="bash", command="sudo sed '341 i   kubectl apply -f \"https:\/\/raw.githubusercontent.com\/flannel-io\/flannel\/9de10c12c8266b0cfe09bc0d5c969ae28832239f\/Documentation\/kube-flannel.yml\"' /tmp/12 > /tmp/123"))
+
+node.addService(rspec.Execute(shell="bash", command="cd /ric-plt/bin && sudo cp /tmp/123 install_k8s_and_helm.sh && sudo ./install_k8s_and_helm.sh 2>&1 | tee /tmp/k8s.log"))
+node.addService(rspec.Execute(shell="bash", command="cd /ric-plt/bin && sudo ./install_common_templates_to_helm.sh 2>&1 >> /tmp/common.log"))
+node.addService(rspec.Execute(shell="bash", command="cd /ric-plt/RECIPE_EXAMPLE && sudo rm example_recipe_latest_stable.yaml && sudo ln -s example_recipe_oran_f_release.yaml example_recipe_latest_stable.yaml"))
+node.addService(rspec.Execute(shell="bash", command="cd /ric-plt/bin && sudo cat ../RECIPE_EXAMPLE/example_recipe_latest_stable.yaml | sed -e 's/10\.0\.0\.1//g' > /tmp/example_recipe_latest_stable.yaml.overwrite && sudo cp /tmp/example_recipe_latest_stable.yaml.overwrite ../RECIPE_EXAMPLE/example_recipe_latest_stable.yaml.overwrite && sudo ./install -f ../RECIPE_EXAMPLE/example_recipe_latest_stable.yaml.overwrite 2>&1 | tee /tmp/install.log"))
+pc.printRequestRSpec(request)
diff --git a/XTesting/powder-profiles/ubuntu-20 b/XTesting/powder-profiles/ubuntu-20
new file mode 100644
index 0000000..6f87865
--- /dev/null
+++ b/XTesting/powder-profiles/ubuntu-20
@@ -0,0 +1,22 @@
+"""Ubuntu 20.04 on a hardware type of your choice."""
+
+import geni.portal as portal
+# Import the ProtoGENI library.
+import geni.rspec.pg as rspec
+
+pc = portal.Context()
+
+pc.defineParameter('hardware_type', 'Hardware type', portal.ParameterType.NODETYPE, '')
+
+params = pc.bindParameters()
+
+request = pc.makeRequestRSpec()
+
+node = request.RawPC('node-0')
+node.hardware_type = params.hardware_type
+node.disk_image = 'urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU20-64-STD'
+
+# manipulate the authorized key for root access 
+node.addService(rspec.Execute(shell="bash", command="sudo chown osc_int  -R /root && tail -1 ~/.ssh/authorized_keys >> /root/.ssh/authorized_keys && rm /root/.ssh/id_rsa* && sudo chown root -R /root"))
+
+pc.printRequestRSpec(request)