本文整理汇总了Python中mininet.net.Mininet.items方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.items方法的具体用法?Python Mininet.items怎么用?Python Mininet.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.net.Mininet
的用法示例。
在下文中一共展示了Mininet.items方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import items [as 别名]
def main():
topo = AttackTopo()
info( '*** Creating network\n' )
net = Mininet(topo=topo)
net.start()
# Print the elements of the network
for item in net.items():
print item
h1, h2, attacker, s1 = net.get('h1', 'h2', 'h3', 's1')
# Start a ssh server on host 2
start_telnet(h2)
CLI(net)
stop_telnet(h2)
net.stop()
示例2: main
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import items [as 别名]
def main():
topo = AttackTopo()
info( '*** Creating network\n' )
net = Mininet(topo=topo)
net.start()
# Print the elements of the network
for item in net.items():
print item
print "Encoded log file at %s" % LOG_FILE_PATH
print "Decoded log file at %s" % DECODED_LOG_FILE_PATH
h1, h2, attacker, s1 = net.get('h1', 'h2', 'h3', 's1')
# Start a ssh server on host 2
start_sshd(h2)
create_attack_log(attacker)
CLI(net)
stop_sshd()
delete_attack_log(attacker)
net.stop()
示例3: fwd
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import items [as 别名]
partial_policy = (
(match(switch = i) >> fwd(2))
+ (match(switch = left_con_num) >> fwd(i))
+ (match(switch = right_con_num) >> fwd(m + 1))
+ ( (~match(switch = i) & ~match(switch = left_con_num) & ~match(switch = right_con_num)) >> fwd(1) )
)
policy += match(dstip = ip_prefix+str(i)) >> partial_policy
for k in range(1, m + 1):
i = k + n
partial_policy = (
(match(switch = i) >> fwd(2))
+ (match(switch = left_con_num) >> fwd(n + 1))
+ (match(switch = right_con_num) >> fwd(k))
+ ( (~match(switch = i) & ~match(switch = left_con_num) & ~match(switch = right_con_num)) >> fwd(1) )
)
policy += match(dstip = ip_prefix+str(i)) >> partial_policy
return policy
if __name__ == "__main__":
topo = TestTopo(2,3)
net = Mininet(topo=topo, host=CPULimitedHost, controller=RemoteController,
listenPort=6634)
net.start()
print net.items()
net.stop()