一、 实验目的

熟悉Mininet自定义拓扑脚本的编写;
熟悉编写POX脚本动态改变转发规则

二、实验原理

在SDN环境中,控制器可以通过对交换机下发流表操作来控制交换机的转发行为。在本实验中,基于Mininet脚本,编写POX脚本,动态改变交换机的转发规则。

三、实验任务

先看一下本次实验的拓扑图:

在该环境下,假设H1 ping H4,初始的路由规则是S1-S2-S5,一秒后,路由转发规则变为S1-S3-S5,再过一秒,规则变为S1-S4-S5,然后再回到最初的转发规则S1-S2-S5。通过这个循环调度的例子动态地改变交换机的转发规则。

1.1在pox文件里面创建脚本lab_controller.py

 from pox.core import core

 import pox.openflow.libopenflow_01 as of

 from pox.lib.util import dpidToStr

 from pox.lib.addresses import IPAddr, EthAddr

 from pox.lib.packet.arp import arp

 from pox.lib.packet.ethernet import ethernet, ETHER_BROADCAST

 from pox.lib.packet.packet_base import packet_base

 from pox.lib.packet.packet_utils import *

 import pox.lib.packet as pkt

 from pox.lib.recoco import Timer

 import time

 log = core.getLogger()

 s1_dpid=0

 s2_dpid=0

 s3_dpid=0

 s4_dpid=0

 s5_dpid=0

 s1_p1=0

 s1_p4=0

 s1_p5=0

 s1_p6=0

 s2_p1=0

 s3_p1=0

 s4_p1=0

 pre_s1_p1=0

 pre_s1_p4=0

 pre_s1_p5=0

 pre_s1_p6=0

 pre_s2_p1=0

 pre_s3_p1=0

 pre_s4_p1=0

 turn=0

 def getTheTime():  #fuction to create a timestamp

   flock = time.localtime()

   then = "[%s-%s-%s" %(str(flock.tm_year),str(flock.tm_mon),str(flock.tm_mday))

   if int(flock.tm_hour)<10:

     hrs = "0%s" % (str(flock.tm_hour))

   else:

     hrs = str(flock.tm_hour)

   if int(flock.tm_min)<10:

     mins = str(flock.tm_min)

     secs = "0%s" % (str(flock.tm_sec))

   else:

     secs = str(flock.tm_sec)

   then +="]%s.%s.%s" % (hrs,mins,secs)

   return then

 def _timer_func ():

   global s1_dpid, s2_dpid, s3_dpid, s4_dpid, s5_dpid,turn

   #print getTheTime(), "sent the port stats request to s1_dpid"

   if turn==0:

       msg = of.ofp_flow_mod()

       msg.command=of.OFPFC_MODIFY_STRICT

       msg.priority =100

       msg.idle_timeout = 0

       msg.hard_timeout = 0

       msg.match.dl_type = 0x0800

       msg.match.nw_dst = "10.0.0.4"

       msg.actions.append(of.ofp_action_output(port = 5))

       core.openflow.getConnection(s1_dpid).send(msg)

       turn=1

       return

   if turn==1:

       msg = of.ofp_flow_mod()

       msg.command=of.OFPFC_MODIFY_STRICT

       msg.priority =100

       msg.idle_timeout = 0

       msg.hard_timeout = 0

       msg.match.dl_type = 0x0800

       msg.match.nw_dst = "10.0.0.4"

       msg.actions.append(of.ofp_action_output(port = 6))

       core.openflow.getConnection(s1_dpid).send(msg)

       turn=2

       return

   if turn==2:

       msg = of.ofp_flow_mod()

       msg.command=of.OFPFC_MODIFY_STRICT

       msg.priority =100

       msg.idle_timeout = 0

       msg.hard_timeout = 0

       msg.match.dl_type = 0x0800

       msg.match.nw_dst = "10.0.0.4"

       msg.actions.append(of.ofp_action_output(port = 4))

       turn=0

       return

 def _handle_portstats_received (event):

   global s1_p1,s1_p4, s1_p5, s1_p6, s2_p1, s3_p1, s4_p1

   global pre_s1_p1,pre_s1_p4, pre_s1_p5, pre_s1_p6, pre_s2_p1, pre_s3_p1, pre_s4_p1

   if event.connection.dpid==s1_dpid:

     for f in event.stats:

       if int(f.port_no)<65534:

         if f.port_no==1:

           pre_s1_p1=s1_p1

           s1_p1=f.rx_packets

         if f.port_no==4:

           pre_s1_p4=s1_p4

           s1_p4=f.tx_packets

           #s1_p4=f.tx_bytes

         if f.port_no==5:

           pre_s1_p5=s1_p5

           s1_p5=f.tx_packets

         if f.port_no==6:

           pre_s1_p6=s1_p6

           s1_p6=f.tx_packets

     for f in event.stats:

        if int(f.port_no)<65534:

          if f.port_no==1:

            pre_s2_p1=s2_p1

            s2_p1=f.rx_packets

            #s2_p1=f.rx_bytes

   if event.connection.dpid==s3_dpid:

      for f in event.stats:

        if int(f.port_no)<65534:

          if f.port_no==1:

            pre_s3_p1=s3_p1

            s3_p1=f.rx_packets

   if event.connection.dpid==s4_dpid:

      for f in event.stats:

        if int(f.port_no)<65534:

          if f.port_no==1:

            pre_s4_p1=s4_p1

            s4_p1=f.rx_packets

 def _handle_ConnectionUp (event):

   global s1_dpid, s2_dpid, s3_dpid, s4_dpid, s5_dpid

   print "ConnectionUp: ",dpidToStr(event.connection.dpid)

   #remember the connection dpid for switch

   for m in event.connection.features.ports:

     if m.name == "s1-eth1":

       s1_dpid = event.connection.dpid

       print "s1_dpid=", s1_dpid

     elif m.name == "s2-eth1":

       s2_dpid = event.connection.dpid

       print "s2_dpid=", s2_dpid

     elif m.name == "s3-eth1":

       s3_dpid = event.connection.dpid

     elif m.name == "s4-eth1":

       s4_dpid = event.connection.dpid

       print "s4_dpid=", s4_dpid

     elif m.name == "s5-eth1":

       s5_dpid = event.connection.dpid

       print "s5_dpid=", s5_dpid

   if s1_dpid<>0 and s2_dpid<>0 and s3_dpid<>0 and s4_dpid<>0:

     Timer(1, _timer_func, recurring=True)

 def _handle_PacketIn(event):

   global s1_dpid, s2_dpid, s3_dpid, s4_dpid, s5_dpid

   packet=event.parsed

   if event.connection.dpid==s1_dpid:

      a=packet.find('arp')

      if a and a.protodst=="10.0.0.4":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=4))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.5":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=5))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.6":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=6))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.1":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=1))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.2":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=2))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.3":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=3))

        event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.1"

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.2"

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.3"

      msg.actions.append(of.ofp_action_output(port = 3))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 1

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.4"

      msg.actions.append(of.ofp_action_output(port = 4))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.5"

      msg.actions.append(of.ofp_action_output(port = 5))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.6"

      msg.actions.append(of.ofp_action_output(port = 6))

      event.connection.send(msg)

   elif event.connection.dpid==s2_dpid:

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 1

      msg.match.dl_type=0x0806

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 1

      msg.match.dl_type=0x0800

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 2

      msg.match.dl_type=0x0806

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 2

      msg.match.dl_type=0x0800

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

   elif event.connection.dpid==s3_dpid:

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 1

      msg.match.dl_type=0x0806

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 1

      msg.match.dl_type=0x0800

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 2

      msg.match.dl_type=0x0806

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 2

      msg.match.dl_type=0x0800

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

   elif event.connection.dpid==s4_dpid:

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 1

      msg.match.dl_type=0x0806

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 1

      msg.match.dl_type=0x0800

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 2

      msg.match.dl_type=0x0806

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =10

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.in_port = 2

      msg.match.dl_type=0x0800

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

   elif event.connection.dpid==s5_dpid:

      a=packet.find('arp')

      if a and a.protodst=="10.0.0.4":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=4))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.5":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=5))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.6":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=6))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.1":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=1))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.2":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=2))

        event.connection.send(msg)

      if a and a.protodst=="10.0.0.3":

        msg = of.ofp_packet_out(data=event.ofp)

        msg.actions.append(of.ofp_action_output(port=3))

        event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.1"

      msg.actions.append(of.ofp_action_output(port = 1))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.2"

      msg.actions.append(of.ofp_action_output(port = 2))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.3"

      msg.actions.append(of.ofp_action_output(port = 3))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.4"

      msg.actions.append(of.ofp_action_output(port = 4))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.5"

      msg.actions.append(of.ofp_action_output(port = 5))

      event.connection.send(msg)

      msg = of.ofp_flow_mod()

      msg.priority =100

      msg.idle_timeout = 0

      msg.hard_timeout = 0

      msg.match.dl_type = 0x0800

      msg.match.nw_dst = "10.0.0.6"

      msg.actions.append(of.ofp_action_output(port = 6))

      event.connection.send(msg)

 def launch ():

   global start_time

   core.openflow.addListenerByName("PortStatsReceived",_handle_portstats_received)

   core.openflow.addListenerByName("ConnectionUp", _handle_ConnectionUp)

   core.openflow.addListenerByName("PacketIn",_handle_PacketIn)

1.2查看流表项(做完步骤2再回来)

 ./pox.py lab_controller web messenger messenger.log_service messenger.ajax_transport openflow.of_service poxdesk

然后再火狐里面搜索:http://pox-ip:8000/poxdesk然后点击TableViewer选择s1即00-00-00-00-01就会跳出下图(其中深蓝色的交换机的output的端口就是在5,6的切换,时而还会出现不存在(个人是这认为ox脚本的bug)说明了只有两种切换方式,而另一种(连向4的)不通,说明了网络运行的时候在s1的OUTPUT:4处出现了问题,这个待我日后分析lab_controller.py再说吧。

2.1在mininet文件夹里面创建脚本文件rulemininet.py

 #!/usr/bin/python

 # coding:utf -8 

 from mininet.topo import Topo

 from mininet.net import Mininet

 from mininet.node import CPULimitedHost

 from mininet.link import TCLink

 from mininet.util import dumpNodeConnections

 from mininet.log import setLogLevel

 from mininet.node import Controller 

 from mininet.cli import CLI

 from functools import partial

 from mininet.node import RemoteController

 import os

  # 创建一个基于拓扑类的MyTopo类使得多交换机连接多个主机和交换机的复杂拓扑

 class MyTopo(Topo):

     "Single switch connected to n hosts."
# 构造函数创建5个交换机和6个主机 def __init__(self): Topo.__init__(self) s1=self.addSwitch('s1') s2=self.addSwitch('s2') s3=self.addSwitch('s3') s4=self.addSwitch('s4') s5=self.addSwitch('s5') h1=self.addHost('h1') h2=self.addHost('h2') h3=self.addHost('h3') h4=self.addHost('h4') h5=self.addHost('h5') h6=self.addHost('h6') # 主机1,2,3连接s1 self.addLink(h1, s1, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(h2, s1, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(h3, s1, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) # 交换机2,3,4连接s1,所以说s1有6个接口 self.addLink(s1, s2, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(s1, s3, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(s1, s4, bw=1, delay='10ms', loss=0, max_queue_size=1000,use_htb=True) # 交换机2,3,4连接s5,所以说s5也有6个接口,2,3,4各两个 self.addLink(s2, s5, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(s3, s5, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(s4, s5, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) # 主机4,5,6连接s5 self.addLink(s5, h4, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(s5, h5, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) self.addLink(s5, h6, bw=1, delay='10ms', loss=0, max_queue_size=1000, use_htb=True) def perfTest(): # 创建网络并运行简单性能测试 topo = MyTopo() net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink, controller=partial(RemoteController, ip='10.0.0.13', port=6633)) net.start() print "Dumping host connections" dumpNodeConnections(net.hosts) h1,h2,h3=net.get('h1','h2','h3') h4,h5,h6=net.get('h4','h5','h6') h1.setMAC("0:0:0:0:0:1") h2.setMAC("0:0:0:0:0:2") h3.setMAC("0:0:0:0:0:3") h4.setMAC("0:0:0:0:0:4") h5.setMAC("0:0:0:0:0:5") h6.setMAC("0:0:0:0:0:6") CLI(net) net.stop() if __name__ == '__main__': setLogLevel('info') perfTest()

2.2 先打开脚本文件lab_controller.py然后打开rulemininet.py ,分别用两个程序

 cd pox

 ./pox.py lab_controller

 cd mininet

 ./rulemininet.py

 h1 ping -i 0.1 h4

rulemininet.py脚本的显示情况:

然而,pox理论上应当显示的是:

而我的是。。

所以这应当是pox的脚本问题,于是我才使用查看流表项的方式来分析。

总结:

1.学会了使用查看流表项

2.理解这个动态拓扑的原理

Mininet系列实验(六):Mininet动态改变转发规则实验的更多相关文章

  1. mininet实验 动态改变转发规则实验

    写在前面 本实验参考 POX脚本设置好控制器的转发策略,所以只要理解脚本. mininet脚本设置好拓扑和相关信息,所以也只要理解脚本. POX脚本目前基本看不懂. 本实验我学会了:POX控制器Web ...

  2. Mininet实验 动态改变转发规则

    介绍 拓扑如下: 在该环境下,假设H1 ping H4,初始的路由规则是S1-S2-S5,一秒后,路由转发规则变为S1-S3-S5,再过一秒,规则变为S1-S4-S5,然后再回到最初的转发规则S1-S ...

  3. Mininet 系列实验(六)

    写在前面 这次实验遇到了非常多问题,非常非常多,花了很多时间去解决,还是有一些小问题没有解决,但是基本上能完成实验.建议先看完全文再开始做实验. 实验内容 先看一下本次实验的拓扑图: 在该环境下,假设 ...

  4. SSH的本地、远程、动态端口转发实验笔记

    SSH端口转发 SSH 会自动加密和解密所有 SSH 客户端与服务端之间的网络数据.但是,SSH 还能够将其他 TCP 端口的网络数据通过 SSH 链接来转发,并且自动提供了相应的加密及解密服务.这一 ...

  5. Mininet 系列实验(四)

    实验内容 本次实验拓扑图: 在该环境下,h0 向 h1 发送数据包,由于在 mininet 脚本中设置了连接损耗率,在传输过程中会丢失一些包,本次实验的目的是展示如何通过控制器计算路径损耗速率(h0- ...

  6. Mininet 系列实验(三)

    实验内容 基础 Mininet 可视化界面进行自定义拓扑及拓扑设备自定义设置,实现自定义脚本应用. 参考 Mininet可视化应用 实验环境 虚拟机: Oracle VM VirtualBox Ubu ...

  7. Mininet 系列实验(一)

    关于SDN的第一个实验,似乎实验室里的前辈们也都是从这里开始的. 实验内容 使用源码安装Mininet 参考 Mininet使用源码安装 实验环境 虚拟机:Oracle VM VirtualBox U ...

  8. Mininet系列实验(五):Mininet设置带宽之简单性能测试

    1.实验目的 该实验通过Mininet学习python自定义拓扑实现,可在python脚本文件中设计任意想要的拓扑,简单方便,并通过设置交换机和主机之间链路的带宽.延迟及丢包率,测试主机之间的性能.在 ...

  9. Mininet系列实验(二):Mininet可视化应用

    1 实验目的 该实验通过Mininet学习miniedit可视化操作,可直接在界面上编辑任意想要的拓扑,生成python自定义拓扑脚本,简单方便.在实验过程中,可以了解以下方面的知识: Miniedi ...

随机推荐

  1. English-培训6-Do you like rap?

  2. Vue动画操作

    概述 Vue 在插入.更新或者移除 DOM 时,提供多种不同方式的应用过渡效果.包括以下工具: 在 CSS 过渡和动画中自动应用 class 可以配合使用第三方 CSS 动画库,如 Animate.c ...

  3. linux复制、压缩打包、解压缩等操作

    1. 复制:cp命令,可复制一个文件夹下的所有文件和子目录.子文件,但是不包括本目录名,例如:不想包含目录名python3.7,想包含的是该目录下的所有子文件和子目录 cp -r /usr/local ...

  4. 用js刷剑指offer(二叉搜索树与双向链表)

    题目描述 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表.要求不能创建任何新的结点,只能调整树中结点指针的指向. 牛客网链接 js代码 /* function TreeNode(x) { ...

  5. 算法102----360笔试(m进制不进位相加最大值)

    转自:https://blog.csdn.net/qq_18310041/article/details/99656445 import copy # m进制 m = 5 n = 5 line = [ ...

  6. k8s的pod

    一.Pod的分类 自主式Pod : 控制器管理的Pod:Kubernetes使用更高级的称为Controller的抽象层,来管理Pod实例.每个Pod都有一个特殊的被称为“根容器”的Pause容器. ...

  7. SPOJ LCS Longest Common Substring 和 LG3804 【模板】后缀自动机

    Longest Common Substring 给两个串A和B,求这两个串的最长公共子串. no more than 250000 分析 参照OI wiki. 给定两个字符串 S 和 T ,求出最长 ...

  8. pygame无法自动补全解决方法

    在pycharm中导入pygame 1.  如果出现 AttributeError: module 'pip' has no attribute 'main'问题 找到安装目录下 helpers/pa ...

  9. HTML5 服务器发送事件(Server-Sent Events)

    沈阳SEO:HTML5 服务器发送事件(server-sent event)允许网页获得来自服务器的更新. Server-Sent 事件 - 单向消息传递 Server-Sent 事件指的是网页自动获 ...

  10. 02_View

    1.View 1.基于类的视图 Class-based Views REST framework提供APIView是Django的View的子类 发送到View的Request请求:是REST fra ...