X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Fomf%2Ftesting%2Fnepi_omf5_nitos_ccnring.py;h=680b2a70d7ee5d0b6d225fa030ce6115b704377e;hb=b4af9a40867beff8660612fe20d3838cb375f159;hp=7b9e09b6a5405dc9e67e0fe772c80a114cf256bb;hpb=b3292d8429f07d0e9d21a3ec2d81dbc4b18332d1;p=nepi.git diff --git a/examples/omf/testing/nepi_omf5_nitos_ccnring.py b/examples/omf/testing/nepi_omf5_nitos_ccnring.py index 7b9e09b6..680b2a70 100644 --- a/examples/omf/testing/nepi_omf5_nitos_ccnring.py +++ b/examples/omf/testing/nepi_omf5_nitos_ccnring.py @@ -176,23 +176,23 @@ if __name__ == '__main__': nodes = dict() chann = add_channel(ec, channel, xmpp_slice, xmpp_host) - for i in range(len(all_hosts)): - node = add_node(ec,all_hosts[i], xmpp_slice, xmpp_host) + for i, host in enumerate(all_hosts): + node = add_node(ec ,host, xmpp_slice, xmpp_host) iface = add_interface(ec, all_ip[i], xmpp_slice, xmpp_host) ec.register_connection(node, iface) ec.register_connection(iface, chann) - nodes[all_hosts[i]] = node + nodes[host] = node # CCN setup for the node ccnds = dict() ccnrs = dict() - for i in range(len(all_hosts)): - ccndstart = add_app(ec, nodes[all_hosts[i]], "#ccndstart", "ccndstart &", + for i, host in enumerate(all_hosts): + ccndstart = add_app(ec, nodes[host], "#ccndstart", "ccndstart &", env, xmpp_slice, xmpp_host) - ccnr = add_app(ec, nodes[all_hosts[i]], "#ccnr", "ccnr &", + ccnr = add_app(ec, nodes[host], "#ccnr", "ccnr &", env, xmpp_slice, xmpp_host) - ccnds[all_hosts[i]] = ccndstart - ccnrs[all_hosts[i]] = ccnr + ccnds[host] = ccndstart + ccnrs[host] = ccnr ec.register_condition(ccnr, ResourceAction.START, ccndstart, ResourceState.STARTED, "1s") # CCNDC setup @@ -226,9 +226,9 @@ if __name__ == '__main__': link = [l1u, l1d, l2u, l2d, l3u, l3d, l4u, l4d, l5u, l5d, b1u, b1d, b2u, b2d] # List of condition - for i in range(len(all_hosts)): - ec.register_condition(ccnrs[all_hosts[i]], ResourceAction.START, ccnds[all_hosts[i]], ResourceState.STARTED, "1s") - ec.register_condition(link, ResourceAction.START, ccnrs[all_hosts[i]], ResourceState.STARTED, "1s") + for host in all_hosts: + ec.register_condition(ccnrs[host], ResourceAction.START, ccnds[host], ResourceState.STARTED, "1s") + ec.register_condition(link, ResourceAction.START, ccnrs[host], ResourceState.STARTED, "1s") # Streaming Server pub = add_publish(ec, nodes[host5], movie, xmpp_slice, xmpp_host)