4 import multiprocessing as mp
5 import powder.experiment as pexp
11 from powder.profile import PowderProfile
14 """Based on the return values from the process that starts a given POWDER profile,
15 create ssh connection and run desired commands, e.g., test steps that's already
16 published as scripts or pure commands
20 TEST_SUCCEEDED = 0 # all steps succeeded
21 TEST_FAILED = 1 # one of the steps failed
22 TEST_NOT_STARTED = 2 # could not instantiate an experiment to run the test on
25 powder_host = PowderProfile()
26 # expect the start on a specified profile succeeds and return
27 # an IPv4 address to proceed to the next step
28 status, ip_address = powder_host.run()
31 sys.exit(self.TEST_NOT_STARTED)
32 elif self._start_powder_experiment(ip_address):
33 sys.exit(self.TEST_FAILED)
35 sys.exit(self.TEST_SUCCEEDED)
37 def _start_powder_experiment(self, ip_address):
38 logging.info('Executing ssh commands on host:{}'.format(ip_address))
39 node = pexp.Node(ip_address=ip_address)
40 ssh_node = node.ssh.open()
41 # the example commands shown below are to set up the AI/ML FW from scratch
42 ssh_node.command('sudo groupadd docker && sudo usermod -aG docker osc_int')
44 ssh_node = node.ssh.open()
45 ssh_node.command('git clone https://gerrit.o-ran-sc.org/r/aiml-fw/aimlfw-dep')
46 ssh_node.command('cd aimlfw-dep && bin/install_traininghost.sh 2>&1 | tee /tmp/install.log', timeout=1800)
49 if __name__ == '__main__':
50 powdertest = RunTest()