+ subprocess.call(
+ "vim-emu compute start -d datacenter1 -n vnf3", shell=True)
+ subprocess.call("vim-emu compute list", shell=True)
+ print('->>>>>>> checking running nodes, compute list, and connectivity >>>>>>>>>>')
+
+ # check number of running nodes
+ self.assertEqual(len(self.getContainernetContainers()), 3)
+ self.assertEqual(len(self.net.hosts), 5)
+ self.assertEqual(len(self.net.switches), 2)
+
+ # check compute list result
+ self.assertEqual(len(self.dc[0].listCompute()), 2)
+ self.assertEqual(len(self.dc[1].listCompute()), 1)
+ self.assertTrue(isinstance(
+ self.dc[0].listCompute()[0], EmulatorCompute))
+ self.assertTrue(isinstance(
+ self.dc[0].listCompute()[1], EmulatorCompute))
+ self.assertTrue(isinstance(
+ self.dc[1].listCompute()[0], EmulatorCompute))
+ print("dc1: ", self.dc[0].listCompute())
+ print("dc2: ", self.dc[1].listCompute())
+ self.assertIn("vnf1", list(map(lambda x: x.name, self.dc[0].listCompute())))
+ self.assertIn("vnf2", list(map(lambda x: x.name, self.dc[0].listCompute())))
+ self.assertIn("vnf3", list(map(lambda x: x.name, self.dc[1].listCompute())))
+
+ # check connectivity by using ping
+ self.assertTrue(self.net.ping(
+ [self.dc[0].listCompute()[1], self.dc[0].listCompute()[0]]) <= 0.0)
+ self.assertTrue(self.net.ping(
+ [self.dc[0].listCompute()[0], self.dc[1].listCompute()[0]]) <= 0.0)
+ self.assertTrue(self.net.ping(
+ [self.dc[1].listCompute()[0], self.dc[0].listCompute()[1]]) <= 0.0)
+
+ print('network add vnf1 vnf2->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')