client = paramiko.SSHClient()
client.load_system_host_keys()
-client.connect(hostname='p2p-next-07.grid.pub.ro', username='p2p')
+client.connect(hostname='141.85.37.237', username='marius', password='marius')
+#client.connect(hostname='p2p-next-07.grid.pub.ro', username='p2p')
+stdin, stdout, stderr = client.exec_command('touch gugu dudu')
stdin, stdout, stderr = client.exec_command('ls -l')
-
+print stdout.readlines()
+client.close()
#~ host = "p2p-next-09.grid.pub.ro"
#~ port = 22
#~ transport = paramiko.Transport((host, port))
from lxml import etree
class SwarmInstance:
- def __init__(self, id, list):
+ def __init__(self, id, node_id, list):
self.id = id;
- self.node_id = list[0];
- self.btclient = list[1];
- self.upload_limit = list[2];
- self.download_limit = list[3];
- self.port = list[4];
- self.download_dir = list[5];
- self.upload_dir = list[6];
+ self.node_id = node_id;
+ self.btclient = list[0];
+ self.upload_limit = list[1];
+ self.download_limit = list[2];
+ self.port = list[3];
+ self.download_dir = list[4];
+ self.upload_dir = list[5];
def __str__(self):
return '[%s: %s: %s: %s: %s: %s: %s: %s]' \
class ClientConfig:
def __init__(self, id, node_path, filetype, options):
self.id = id;
- self.node_path = node_path;
self.filetype = filetype;
self.options = options;
#~ self.upload_limit_option= list[2];
return '[%s: %s: %s: %s: %s: %s: %s]' \
%(self.id, self.btclient, self.upload_limit, self.download_limit, self.port, self.upload_dir, self.download_dir);
-#~ tree = etree.parse("swarm.xml")
-#~ root = tree.getroot()
-#~ for elem in root:
- #~ swn = SwarmInstance(elem.get("id"), [elemelem.text for elemelem in elem])
- #~ print swn
- #~ print "=================================="
-
try:
tree = etree.parse("clients.xml")
root = tree.getroot()
- dict = {}
+ clients_options = {}
for elem in root:
id = elem.get("id")
options = [elem2.text for elem2 in elem[1:]]
filetype = [elem[0].get("type")]
filetype.extend([elem2.text for elem2 in elem[0]])
- dict[id] = [options, filetype]
+ clients_options[id] = [filetype, options]
+
+ print clients_options
except IOError as e:
print e
try:
tree = etree.parse("nodes.xml")
root = tree.getroot()
+ nodes = {}
for elem in root:
- list = [elem.get("id")]
- list.extend([elem2.text for elem2 in elem[:len(elem)-1]])
- dict = {}
+ id = elem.get("id")
+ list = [elem2.text for elem2 in elem[:len(elem)-1]]
+ client_paths = {}
for elem2 in elem[len(elem)-1]:
- dict[elem2.get("id")]=elem2[0].text;
- list.append(dict)
- print list
- print "=================================="
+ client_id = elem2.get("id");
+ client_paths [client_id]=elem2[0].text;
+ nodes[id] = [client_paths, list]
+ print nodes
+ print "=================================="
except IOError as e:
print e
+
+try:
+ tree = etree.parse("swarm.xml")
+ root = tree.getroot()
+ swarm = {}
+ for elem in root:
+ id = elem.get("id")
+ list = [elem2.text for elem2 in elem[:len(elem)-1]]
+ swarm[id] = list
+ print swarm
+ print "=================================="
+except IOError as e:
+ print e
+