"""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)